Bug #78402 [Opn->Csd]: Converting null to string in error message is bad DX
Edit report at https://bugs.php.net/bug.php?id=78402&edit=1
ID: 78402
Updated by: nikic@php.net
Reported by: danack@php.net
Summary: Converting null to string in error message is bad DX
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
PHP Version: 7.3.8
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of kentaro@ranvis.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cbb0efaeeb265ff8026dee1d049d57a8d2b5c133
Log: Fix #78402: pcntl_signal() misleading error message
Previous Comments:
------------------------------------------------------------------------
[2019-12-17 18:19:06] kentaro at ranvis dot com
The following pull request has been associated:
Patch Name: Fix #78402: pcntl_signal() misleading error message
On GitHub: https://github.com/php/php-src/pull/5023
Patch: https://github.com/php/php-src/pull/5023.patch
------------------------------------------------------------------------
[2019-08-11 20:29:41] danack@php.net
Description:
------------
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78402&edit=1
Thread (3 messages)