Req #80367 [Opn->Wfx]: Show false instead bool in exceptions
| From: | cmb@php.net | Date: | Sun, 15 Nov 2020 13:36:12 +0000 |
| Subject: | Req #80367 [Opn->Wfx]: Show false instead bool in exceptions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-230368@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80367&edit=1
ID: 80367
Updated by: cmb@php.net
Reported by: michael dot vorisek at email dot cz
Summary: Show false instead bool in exceptions
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: 7.4.12
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
false is not a standalone type[1] (and more like a pseudo-type).
I don't think it makes sense to report it as such. If you
strongly feel about this, please bring that up on the internals
mailing list.
[1] <https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.union.false>
Previous Comments:
------------------------------------------------------------------------
[2020-11-13 23:10:31] michael dot vorisek at email dot cz
Description:
------------
see https://3v4l.org/ko1WZ
false is often an error return type of some previous action and showing explicitly "false"
instead of "bool" improves the explanation value of the php output.
Test script:
---------------
<?php declare(strict_types=1);
function x(string $a) {}
x(false);
Expected result:
----------------
Fatal error: Uncaught TypeError: x(): Argument #1 ($a) must be of type string, false given
Actual result:
--------------
Fatal error: Uncaught TypeError: x(): Argument #1 ($a) must be of type string, bool given
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80367&edit=1