Bug #78402 [NEW]: Converting null to string in error message is bad DX

From: Date: Sun, 11 Aug 2019 20:29:41 +0000
Subject: Bug #78402 [NEW]: Converting null to string in error message is bad DX
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222184@lists.php.net to get a copy of this message
From: danack Operating system: PHP version: 7.3.8 Package: *General Issues Bug Type: Bug Bug description:Converting null to string in error message is bad DX 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 bug report at https://bugs.php.net/bug.php?id=78402&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78402&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78402&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78402&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78402&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78402&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78402&r=support Expected behavior: https://bugs.php.net/fix.php?id=78402&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78402&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78402&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78402&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78402&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78402&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78402&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78402&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78402&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78402&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78402&r=mysqlcfg

« previous php.bugs (#222184) next »