Re: return false if error

From: Date: Wed, 19 Mar 2014 12:18:42 +0000
Subject: Re: return false if error
References: 1 2 3  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969384880@lists.php.net to get a copy of this message
On Wed, 19 Mar 2014, Yasuo Ohgaki wrote: > On Wed, Mar 19, 2014 at 9:52 AM, Hannes Magnusson <hannes.magnusson@gmail.com> wrote: > > > I don't know why or when strpos docs got changed to 'mixed', that > > definitely is not how it was originally: > > http://www.php.net/manual/en/about.prototypes.php > > > > The docs consistently white-lie with "on failure" return value, for > > example; if you pass 10 arguments to strpos() it will not return > > false, it will actually return null. > > > > This is true for ~98% of the documented functions. > > > > We are getting bug reports that function returns NULL for invalid arguments. > We might be better to consider change it to FALSE for invalid arguments > someday. We should be careful for edge case, though. Sorry, but returning NULL for invalid argument has been an established practise that many people also have actively advocated. False should *not* be picked as it is often a valid return value. cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug Posted with an email client that doesn't mangle email: alpine

« previous php.doc (#969384880) next »