Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46584 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9225 invoked from network); 31 Dec 2009 10:34:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2009 10:34:00 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.185 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:51698] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/FC-12956-61E7C3B4 for ; Thu, 31 Dec 2009 05:34:00 -0500 Received: from us-gw1.zend.com (unknown [192.168.16.5]) by il-mr1.zend.com (Postfix) with ESMTP id 52A0550489; Thu, 31 Dec 2009 12:18:42 +0200 (IST) Received: from [192.168.27.1] ([192.168.27.1]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 31 Dec 2009 02:33:53 -0800 Message-ID: <4B3C7E0C.3030907@zend.com> Date: Thu, 31 Dec 2009 02:33:48 -0800 Organization: Zend Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b2pre Thunderbird/3.0 MIME-Version: 1.0 To: RQuadling@googlemail.com CC: Alexey Zakhlestin , PHP Internals References: <4B3C4041.6000406@zend.com> <10845a340912310226rdb09b26v12551fab5aedd5ae@mail.gmail.com> In-Reply-To: <10845a340912310226rdb09b26v12551fab5aedd5ae@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 31 Dec 2009 10:33:53.0594 (UTC) FILETIME=[BFCE21A0:01CA8A04] Subject: Re: [PHP-DEV] invalid params return value From: stas@zend.com (Stanislav Malyshev) Hi! > Would changing the returning value to Null to indicate invalid > arguments (or any other error condition) would create a significant BC > surely? Just how many functions are documented with the entity > &return.falseforfailure;? (198 files using this so far vs Return > &null; which is used very rarely). There are different kinds of failure. There's failure for the function (i.e. function tried to do something and failed, like couldn't open the file) and failure where function wheren't even executed (like you called fopen without giving it a filename). Some functions return the same in both cases, some do not. I'm sure half of the functions documented as &return.falseforfailure; return NULL on incorrect args. As for BC - it may break some scripts that don't check properly but having each function do different thing is worse, since you couldn't even write a proper check - since you have no way of knowing what to check for. > Differentiating between False/Null (something was wrong) and > False/Null (the answer to the question you asked is False or Null) is > pretty impossible without constantly checking the manual to see what > the return values for failure is. It's impossible with or without the change, it's entirely different question. > Of course, the question I would next ask (and, oh look, am doing so) > is could an exception be thrown? Invalid arguments is a pretty No, exception is not a good thing (that's why I didn't mention it) since a lot of code isn't organized in a way that exceptions can be properly handled, and using exceptions in this case would pretty much lead to using exceptions for any error handling which I don't think PHP community agrees to, and also entirely different topic. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com