Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42825 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34187 invoked from network); 25 Jan 2009 15:29:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2009 15:29:22 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:52653] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/EA-55096-2558C794 for ; Sun, 25 Jan 2009 10:29:22 -0500 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id 79AD0414405B; Sun, 25 Jan 2009 15:30:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ur6YU5C0IVfu; Sun, 25 Jan 2009 16:30:12 +0100 (CET) Received: from [192.168.0.151] (77-58-151-147.dclient.hispeed.ch [77.58.151.147]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 648A94144009; Sun, 25 Jan 2009 16:30:12 +0100 (CET) Cc: "Mark van der Velden" , internals@lists.php.net Message-ID: <1152F0CE-5576-4076-A4A2-B2DC7F6E8665@pooteeweet.org> To: Etienne Kneuss In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Sun, 25 Jan 2009 16:29:17 +0100 References: <496CB6BE.2000704@dynom.nl> X-Mailer: Apple Mail (2.930.3) Subject: Re: [PHP-DEV] SPL ArrayAccess offsetExists default behavior From: mls@pooteeweet.org (Lukas Kahwe Smith) On 13.01.2009, at 16:58, Etienne Kneuss wrote: > 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. Hmm, maybe still worthwhile to classify it as a bug fix? :) regards, Lukas Kahwe Smith mls@pooteeweet.org