Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72989 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40774 invoked from network); 7 Mar 2014 10:14:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2014 10:14:22 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.172 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:39397] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/C1-27298-CFB99135 for ; Fri, 07 Mar 2014 05:14:21 -0500 Received: by mail-vc0-f172.google.com with SMTP id la4so492941vcb.17 for ; Fri, 07 Mar 2014 02:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=QW8HUgBJ4liPBJ+PEINHjYZMd9+7xAdRPzJa3/8+kiQ=; b=XNnQMNTEjWBqmd8ZMWnJOpXvusSzSzYxl4JkSH1xnlHOSIyfr3KrsjuG8JBZpsGaWH 0nfz40C8duru2ObeHWou4KnWWmzCjKEMuggZU0KNsda/okPR1EgKedVLY7n1uusYq+ZK cjIiMH443Be+JE0UmAeP95XONu5jPB17Zfyxbpy0LMnx7ENh4fToSgl0xF6uVaQRt5Q8 9vOa5l0NczerDKsJ0SJHNEp0VL/gxkW88u6oLBfgONFLd789Lh15zvokcHz121+w/MyJ yB19r8SfLP7yCk3SYRoeHRyzFkxw3b0kN1QVPqdZgD9mGhml8IXiw5UgNiuaYkhHYQKm 9WNA== MIME-Version: 1.0 X-Received: by 10.220.92.135 with SMTP id r7mr9307509vcm.11.1394187258111; Fri, 07 Mar 2014 02:14:18 -0800 (PST) Received: by 10.58.55.131 with HTTP; Fri, 7 Mar 2014 02:14:18 -0800 (PST) Date: Fri, 7 Mar 2014 18:14:18 +0800 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=047d7b66f5fb452d2604f4018406 Subject: [PR 614] ArrayObject and isset() / empty() behaviour From: tjerk.meesters@gmail.com (Tjerk Meesters) --047d7b66f5fb452d2604f4018406 Content-Type: text/plain; charset=ISO-8859-1 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. -- -- Tjerk --047d7b66f5fb452d2604f4018406--