Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88321 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47154 invoked from network); 18 Sep 2015 13:44:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 13:44:54 -0000 Authentication-Results: pb1.pair.com header.from=stig.bakken@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stig.bakken@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.174 as permitted sender) X-PHP-List-Original-Sender: stig.bakken@gmail.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:37185] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/69-19961-4551CF55 for ; Fri, 18 Sep 2015 09:44:53 -0400 Received: by wicfx3 with SMTP id fx3so31720345wic.0 for ; Fri, 18 Sep 2015 06:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=yufotEpnepiMkP35WQagOgCCuzAF2Tp95haZiz0iA0k=; b=f8dvVt3pkrOkTCY1dl13vLoSOAa5mlZAgORhDLsDAUnJUVuK09lELzvNnMxn6cKyL9 hFEPEwlFsFTuxY4Z/goJehNkRNqIbRVnuj+E2s7XyVUVaZnljHt/MMPDvBx1aV6e0KB1 ntMeOHCbERQ5zZYUB5SKpYm8IUqnA9OGpC/R8apOK9aUK3jg6Ewx1C5fUidNbpRjoHev ILHUPSc0ioUB1bJBX2yhvgOQiNEhZwXZNILSmt5+sphTd5wKYnLtC3VNBxjv97Nv0JTB 4ePzmy7rFBlt1I15UHtWs+YKD4zt7Dl0ILgk/42vYYMFqbUs6KDG+rd3JeXO/TzQY2/Q KMOA== MIME-Version: 1.0 X-Received: by 10.180.84.163 with SMTP id a3mr39087697wiz.34.1442583889711; Fri, 18 Sep 2015 06:44:49 -0700 (PDT) Sender: stig.bakken@gmail.com Received: by 10.194.157.97 with HTTP; Fri, 18 Sep 2015 06:44:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 18 Sep 2015 15:44:49 +0200 X-Google-Sender-Auth: BHX1sB39KVPQztYhEgAvlaQIcTs Message-ID: To: Scott Arciszewski Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: stig@stigbakken.com (Stig Bakken) On Wed, Aug 26, 2015 at 5:09 AM, Scott Arciszewski wrote: > Hi everybody, > > Would anyone be interested in adding another helper like > isset()/empty() simply called exists() which would return true if the > variable is defined in the current scope (i.e. without raising an > E_NOTICE)? > > It should be a simple change to add this function but it's too late > for 7.0 so, if there is any interest, I would respectfully put it off > until 7.1. After reading through this thread (most of it anyway), the thing that strikes me is that many people expect the wrong thing from isset(). I believe that the reason for this is that the name isset() is slightly misleading. I wouldn't blame anyone for assuming that it acually checks that a variable "is set", and not even considering the corner case of when it does exist with a null value. What lesson can we learn from that? Short and sweet names sometimes lead to problems, if they do not precisely convey the actual semantics. I would much rather see a function called something like is_variable_defined(), to avoid running into the same trap with exists(). No room for assumptions that lead you to not check the docs. - Stig