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
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: 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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 06:01:28 2024 UTC