Re: RFC: Catchable "call to a member function of a non-object"

From: Date: Sun, 27 Apr 2014 17:10:49 +0000
Subject: Re: RFC: Catchable "call to a member function of a non-object"
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-73815@lists.php.net to get a copy of this message
Hello Timm,

a good use case would also be a backtrace from non-object fatals:

set_error_handler(function($code, $message) {
  var_dump($code, $message);
  debug_print_backtrace();
}, E_RECOVERABLE_ERROR);
 
$m = new some_db_model();
$row = $m->find(42); // null, deleted concurrently
$row->delete();

Without the backtrace, I always have to guess what happened in the code to fix the issue.

Regards
Thomas


php@thekid.de wrote on 27.04.2014 14:00:

> Hello everyone,
> 
> as per the RFC process I'd like to start a discussion on the RFC
> I've put up on the RFC Wiki:
> 
>   https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
>   RFC: Catchable "call to a member function of a non-object", 1.0
> 
> The essence of this pull request is that it converts this fatal error
> into E_RECOVERABLE_ERRORs. Framework authors may choose to convert
> these into exceptions, as they already do with argument type mismatches.
> 
> Feedback is welcome!
> 
> - Timm
> 
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Thread (11 messages)

« previous php.internals (#73815) next »