Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72991 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65503 invoked from network); 7 Mar 2014 14:16:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2014 14:16:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.173 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.128.173 mail-ve0-f173.google.com Received: from [209.85.128.173] ([209.85.128.173:33986] helo=mail-ve0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/11-57079-0B4D9135 for ; Fri, 07 Mar 2014 09:16:16 -0500 Received: by mail-ve0-f173.google.com with SMTP id oy12so4213820veb.18 for ; Fri, 07 Mar 2014 06:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=QKbZ6A1hVVeatDNbAeuFNXiK+sY7qzpK/23mmQ5x5a8=; b=NR5HiwLNO0tUquba6w/isAjFdQIr0k/P3bLhsRM3ZafOj3xLS9B+WM3wattGaXfGUi 6qbfZASe2WddPZBfwGYv2ihmpJQ6lJOCvUFpFYrEDxV2dpG5nAxlXBSPpf//A/JRZTHw /u/YuhKTMiB8ZVtqHhhvHihBVgCAOOeLc/mbX38omqDr+PG8Y6TBccqWcRXZcJWwNubG 047TxjWoBtp7oHUOx5tQO4MxnMF+/V0ZKj003xU29SoW02+UpHnf/p1AAkzUNiNQQ/jN TopdIkTpvUQk2B415NK7OyzYmRUDEHI/dDShat7Kqwi+lhZbM64eh8sb8g0BG8+lDfIy JFwg== X-Received: by 10.52.161.130 with SMTP id xs2mr264041vdb.49.1394201773825; Fri, 07 Mar 2014 06:16:13 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.81.68 with HTTP; Fri, 7 Mar 2014 06:15:33 -0800 (PST) In-Reply-To: References: Date: Fri, 7 Mar 2014 15:15:33 +0100 X-Google-Sender-Auth: vSKx8HzGaGsb6-bK05ahQO47PZs Message-ID: To: Tjerk Meesters Cc: PHP Internals , Etienne Kneuss Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [PR 614] ArrayObject and isset() / empty() behaviour From: jpauli@php.net (Julien Pauli) On Fri, Mar 7, 2014 at 11:14 AM, Tjerk Meesters wrote: > Hi, > > I come across the following bug: https://bugs.php.net/bug.php?id=66834 > > With an extended ArrayObject instance, the behaviour of `isset()` and > `empty()` is as follows: > > 1. Call `static::offsetExists()` > 2. If return value is truthy, then > a. isset() returns true > b. empty() returns false > c. spl_array_has_property() returns true > > However, if the ArrayObject instance is not overridden: > > 1. Fetch value (either via string or long key) > 2. If key is found, then: > a. isset() returns false if value is `null`, true otherwise. > b. empty() returns true if value is truty, false otherwise. > c. spl_array_has_property() returns true > > That's counterintuitive, so my patch addresses this by also calling > `offsetGet()` if applicable. I wanted to bring this to the attention of the > group first, because it may affect performance to achieve this goal: > > https://github.com/php/php-src/pull/614 > > I've tried to contact Marcus Boerger, but I was told that he's been less > active lately. Let me know your thoughts. The patch targets 5.4 onwards. You should try to contact Etienne Kneuss, he'll be able to help. He is often available on IRC. Julien