php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76162 type-hint broken with custom error handling function
Submitted: 2018-03-29 13:35 UTC Modified: 2018-03-29 13:46 UTC
From: joseaugustodearaujonascimento at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: Unknown/Other Function
PHP Version: 5.6.34 OS: Debian 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joseaugustodearaujonascimento at gmail dot com
New email:
PHP Version: OS:

 

 [2018-03-29 13:35 UTC] joseaugustodearaujonascimento at gmail dot com
Description:
------------
This bug only affects PHP versions 5.6.x.

Test script:
---------------
<?php
class Event {
    public function setTime(\DateTime $time) {
       var_dump($time);
    }
}
function set_event_time(\DateTime $time) {
    var_dump($time);
}
function e_handler() {
    restore_error_handler();
}
set_error_handler('e_handler');

$e = new Event();
$e->setTime(false);

set_event_time(false);

Expected result:
----------------
Fatal error: Uncaught TypeError: Argument 1 passed to Event::setTime() must be an instance of DateTime, boolean given, called in %s on line %d and defined in %s:%d

Actual result:
--------------
bool(false)
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-29 13:46 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Package: PHP Language Specification +Package: Unknown/Other Function -Assigned To: +Assigned To: cmb
 [2018-03-29 13:46 UTC] cmb@php.net
> This bug only affects PHP versions 5.6.x.

Active support for PHP 5.6 ended more than a year ago[1].

[1] <http://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jul 03 11:05:45 2022 UTC