Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46581 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1478 invoked from network); 31 Dec 2009 09:44:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2009 09:44:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.78.25 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 74.125.78.25 ey-out-2122.google.com Received: from [74.125.78.25] ([74.125.78.25:31285] helo=ey-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/9B-12956-5827C3B4 for ; Thu, 31 Dec 2009 04:44:38 -0500 Received: by ey-out-2122.google.com with SMTP id 9so2162901eyd.39 for ; Thu, 31 Dec 2009 01:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=IcVLQ4cDAUuty1BZRwPIDGwnJyiz5LMBkt6GURP6G1M=; b=cfPyPXKdte7/qiW2g0pF994vg1RcD73aXonzUL2ISoOpRXdtNKlHMcYNnumXRp0bCg Q5j4NCT0T9Tkg158R+ZidNz7rigyXu2uAaN0VLGKAtSEaQil9V5kajvGMmrbTBM4QL1l iZO6Vpx58a0T3b2fx2M3UIYLsT0awpIJ7iUGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=HX//RDKOVjNXZdQ8SbZukPYyDKOzSsuhiNELHezK93AebWYS2LCO47jy8pG5ffry5P vlY4d9SaSawhaCCUqczZSSScXzStFsQc2RuO608HCqKanKGbL8wO7HmZ8+yROJJnOZEO ip3PC72u2aE5eklxi3J3o/1AaRa/yuiBMKBqI= MIME-Version: 1.0 Received: by 10.216.85.213 with SMTP id u63mr3447860wee.15.1262252674372; Thu, 31 Dec 2009 01:44:34 -0800 (PST) In-Reply-To: <4B3C4041.6000406@zend.com> References: <4B3C4041.6000406@zend.com> Date: Thu, 31 Dec 2009 10:44:34 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] invalid params return value From: indeyets@gmail.com (Alexey Zakhlestin) On Thu, Dec 31, 2009 at 7:10 AM, Stanislav Malyshev wrote: > 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? standard macro is a good idea. I also think, that NULL makes more sense in this case. NULL kinda means "nothing was returned", which should be the case exactly (as function didn't start to work, actually) -- Alexey Zakhlestin http://www.milkfarmsoft.com/ Sent from Prague, Czech Republic