Re: Make zend_parse_parameters emit E_RECOVERABLE_ERROR

From: Date: Mon, 01 Sep 2014 03:56:04 +0000
Subject: Re: Make zend_parse_parameters emit E_RECOVERABLE_ERROR
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-77002@lists.php.net to get a copy of this message
On Mon, Sep 1, 2014 at 6:01 AM, Andrea Faulds <ajf@ajf.me> wrote: > Good evening, > > Here’s a suggestion: Why don’t we make zend_parse_parameters emit ""Why not" is usually not a very good reason for a change in the language syntax. " -- Stas > E_RECOVERABLE_ERROR on failure, rather than just emitting E_WARNING and > returning FAILURE (causing the caller to typically bail out and return NULL)? > This would bring it into line with userland type hints, which also cause such > errors. It might also cause errors to be caught sooner, as just returning NULL > can cause cryptic problems down the line. It’s worth noting that > zend_parse_parameters is very tolerant in terms of what parameters you can pass > it and is unlikely to error unless you do something really weird such as > passing an array to strlen(). PHP is a looser type language... such things might be happened. and internal functions always check their arguments. this will make the PHP app more robust. > I doubt this would affect backwards compatibility > much, unless your application relies on a silenced warning (which is possible, > but discouraged behaviour), and it’s the type of BC break that would be really > obvious (your application errors and stops execution). that will be a nightmare to stop people upgrade their PHP. thanks > > Thoughts? > -- > Andrea Faulds > http://ajf.me/ > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Xinchen Hui @Laruence http://www.laruence.com/

« previous php.internals (#77002) next »