Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83397 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32919 invoked from network); 21 Feb 2015 15:36:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 15:36:31 -0000 Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.213.52 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.213.52 mail-yh0-f52.google.com Received: from [209.85.213.52] ([209.85.213.52:40201] helo=mail-yh0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/09-08895-EF5A8E45 for ; Sat, 21 Feb 2015 10:36:31 -0500 Received: by yhot59 with SMTP id t59so6339532yho.7 for ; Sat, 21 Feb 2015 07:36:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Td+dcfLWozDJYdJuHOhggMwgdmC7fm5Clit77JmjspM=; b=DKxwhsu6EpyNF+gVquoy6cpBSEIy2yLPt8UP/bRMcuVT0rybakfj1lRR4XcOzF8CT6 H3eZmcGwHgg44SHT53dw6ip6ACiv1uV2wqrSDySY4ztPbeSIQ2T6wjyWEPoJab1YW7Wz TKjww16hd3BDf4BZHUpnP9WqQwuXMNAGfw8nlNOMRQB/ZZUz+C8o4goPa793SC/DyQpO JDTu1q6phzLZHvq4Tudf4jatb0kzcQqAT+Wlj0FS/LIQCBjd7B8O2BWVgEEWMxm9ADNP jcPXmml95JGpx+rXSbMvqIRP8P/+qCulnj0r8hnTG63sw07v3tlBWJh8GEjYYnkWTuyH Ex0Q== X-Gm-Message-State: ALoCoQn/FRx0CfdgsoEc8DaKphLd5HvVQQGsrFxE88CzqDPAFnnpnM6DBO8yAWuWX+RTQPQ15Pez MIME-Version: 1.0 X-Received: by 10.236.104.194 with SMTP id i42mr2400923yhg.89.1424532987551; Sat, 21 Feb 2015 07:36:27 -0800 (PST) Received: by 10.170.71.86 with HTTP; Sat, 21 Feb 2015 07:36:27 -0800 (PST) X-Originating-IP: [89.240.52.213] In-Reply-To: <54E831BA.80609@fischer.name> References: <54E831BA.80609@fischer.name> Date: Sat, 21 Feb 2015 15:36:27 +0000 Message-ID: To: Markus Fischer Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Make empty() a Variadic From: danack@basereality.com (Dan Ackroyd) On 21 February 2015 at 07:20, Markus Fischer wrote: > On 21.02.15 06:11, Thomas Punt wrote: > From the RFC: >> Also, it will make empty() more inline with the not-too-disimillar isset(), > > Here I disagree. > > I would have assumed from the start that empty() would only return true > if *all* of the entries are empty, i.e. AND things together. The problem stems from the fact that 'empty' is a falsy statement as it returns true when something is not set. Combining two positive results in another positive statement. Combining two negative statements results in a positive statement.....except when it doesn't. You always have to think about what is the correct way to combine them. From the RFC: > In PHP, it is not uncommon to see conditionals consisting of multiple empty() > invocations. This is evident by simply browsing through some popular open > source projects This is subjective opinion, but at least two of those code examples are horrible. In particular the phpBB code shows the problem of using compound 'falsy' statements: return !( empty($this->config['jab_enable']) || empty($this->config['jab_host']) || empty($this->config['jab_username']) || empty($this->config['jab_password']) || !@extension_loaded('xml') ); Seriously, a double-negative at the end of a five piece statement that combines falsy things? Making it easier to write bad (imo) code does not seem a good reason for a change. cheers Dan