Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42608 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90679 invoked from network); 13 Jan 2009 15:58:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2009 15:58:11 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.157 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 72.14.220.157 fg-out-1718.google.com Received: from [72.14.220.157] ([72.14.220.157:57005] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 80/5C-42308-11ABC694 for ; Tue, 13 Jan 2009 10:58:10 -0500 Received: by fg-out-1718.google.com with SMTP id 16so54239fgg.23 for ; Tue, 13 Jan 2009 07:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=Yxsi+z2Km8lyjHrmAw1KyUv549XXZXqWktCMCZU3msU=; b=bLVpW4+EmFKfA4gBUobjD1tUNuF10vHg6X/27PMgD8JISFlKH04SHxJJGl435PRPTN PM0xx95RtD0gHieNEe8g2K5brMIDKKU8Txm3Ra42BUVGAXRgGG6mbqlyBF9PO544rK4U jJj2eGkRCgAPa6Xq5aiWzbQ/4NhZI1wOzmx6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=I8Q9VFQj7rH2wwT4Dx8Ud9mURgwxfS2xhwQGQR9+1EB+GzCB3B2RWhQVapHCLXqW83 3F3I/IxT1x1SuQ9WkY5jpsETFf5UNg4QICcDZC4k1m6Z6+aAxND8TGPXPrn1Wk46LY+F DvUU7jF3PSV1bV46QVzxN3olCguGI7YhEPXrM= Received: by 10.86.70.3 with SMTP id s3mr437325fga.78.1231862287384; Tue, 13 Jan 2009 07:58:07 -0800 (PST) Received: by 10.86.35.9 with HTTP; Tue, 13 Jan 2009 07:58:07 -0800 (PST) Message-ID: Date: Tue, 13 Jan 2009 16:58:07 +0100 Sender: ekneuss@gmail.com To: "Mark van der Velden" Cc: internals@lists.php.net In-Reply-To: <496CB6BE.2000704@dynom.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <496CB6BE.2000704@dynom.nl> X-Google-Sender-Auth: 609feb25de8fcc82 Subject: Re: [PHP-DEV] SPL ArrayAccess offsetExists default behavior From: webmaster@colder.ch ("Etienne Kneuss") Hello, On Tue, Jan 13, 2009 at 4:43 PM, Mark van der Velden wrote: > Hi list, > > The following doesn't strike me as consistent behavior: > > $a = new ArrayObject(); > $a["foobar"] = NULL; > > echo (int) isset( $a["foobar"] ); // Output: 1 > > > While it's technically correct, I find it confusing. The reason is probably > because of a array_key_exists (or property_exists) check within > offsetExists() that do not take return false on a NULL value, unlike > isset(). > > What say you ? This is indeed a small inconsistency. The problem is that by its name, offsetExists() should return true on those cases (similarly to array_key_exists or property_exists). Since it is directly called within isset(), isset() should return true as well. The problem is that checking the value would cause a offsetGet() to be called, which will be a BC break, so I'm not sure if it's worth changing. Regards > > > - Mark > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal