Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77711 invoked from network); 31 Dec 2009 06:10:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2009 06:10:15 -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:39364] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/08-12956-6404C3B4 for ; Thu, 31 Dec 2009 01:10:15 -0500 Received: from us-gw1.zend.com (unknown [192.168.16.5]) by il-mr1.zend.com (Postfix) with ESMTP id B8ED3504EA for ; Thu, 31 Dec 2009 07:54:58 +0200 (IST) Received: from [192.168.27.1] ([192.168.27.1]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 30 Dec 2009 22:10:09 -0800 Message-ID: <4B3C4041.6000406@zend.com> Date: Wed, 30 Dec 2009 22:10:09 -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: 'PHP Internals' Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 31 Dec 2009 06:10:09.0445 (UTC) FILETIME=[E7E09D50:01CA89DF] Subject: invalid params return value From: stas@zend.com (Stanislav Malyshev) Hi! One of the many things that is chaotic in PHP is what internal function returns when invalid parameters are given (i.e. params parsing fails). Most of those functions do one of: 1a. just return - this happens with most standard ext code, which was converted from old params parsing to a new one. 1b. RETURN_NULL() - this is effectively the same as 1a, but the code is different. 2. RETURN_FALSE - some random set of functions does that, e.g. some of PDO functions (PDO::prepare, PDO::setAttribute, etc.). NB: I'm not singling out PDO here, it happens all over the code, it's just first thing that came to my mind. So, both of the values are kind of OK and both have the same flaw - function could legitimately return both NULL and false. I don't have good argument for either of these as opposed to another one. However, I think we should have ONE standard return value in this case - even better, some macro like RETURN_ARGS_FAIL() (if you have a better name, ok). So, what do you think of that? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com