php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80367 Show false instead bool in exceptions
Submitted: 2020-11-13 23:10 UTC Modified: 2020-11-15 13:36 UTC
From: michael dot vorisek at email dot cz Assigned: cmb (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 7.4.12 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michael dot vorisek at email dot cz
New email:
PHP Version: OS:

 

 [2020-11-13 23:10 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-15 13:36 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2020-11-15 13:36 UTC] cmb@php.net
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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC