Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94768 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81892 invoked from network); 31 Jul 2016 19:31:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2016 19:31:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@mudsite.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave@mudsite.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mudsite.com designates 209.85.223.175 as permitted sender) X-PHP-List-Original-Sender: dave@mudsite.com X-Host-Fingerprint: 209.85.223.175 mail-io0-f175.google.com Received: from [209.85.223.175] ([209.85.223.175:34370] helo=mail-io0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/10-13425-0125E975 for ; Sun, 31 Jul 2016 15:31:29 -0400 Received: by mail-io0-f175.google.com with SMTP id q83so170677973iod.1 for ; Sun, 31 Jul 2016 12:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mudsite-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=8XSs0MylEcIi0wrkbC6lNj2R+dE6MAcDMohzEU6wEnE=; b=lOmIYVb+1Ut4/eigaJWYfGJmtPHOQKMkYcxj8YfCxe+BATNeUB2hM1gr9BRGf4bj9r iFfW5Q0Be7DRPsQNp6liTIdcn/Yv42GjgHWsFpAFG6zxM2VawUi+a4zRUNmOoYVdmeTM QStR0gUvWC4Xz60E63X6K6hZv1ZlAfaKmaOEwxikfoFvDCkFPRytknKgUk+FBpoBkC+E Ey41Bj2AZpR+kwS2L6dyf80A3dUzZM2NpGx9a5n/nBJmYE3cACp8d6fmdPpaISqCNIsG s75YTdvGhVyZRp7Yp006dr8F3g7fmx+/v89DppvK4jubPBq1mOVrEYtySpI7DPnib/82 mqyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8XSs0MylEcIi0wrkbC6lNj2R+dE6MAcDMohzEU6wEnE=; b=DGdnNvBhYmyxTaSuoeRlDSFmYB2+vmpi8up3m+SMZZVMwPr+bWgb7UYMhok4tr4a1Z 0ehyIGTqQX+BqS28+IqZheQHQSeJmDUFXxeGGHoRcwzFQJYOQA8sflLTGXVBud1hD5P5 JTsbDoLKOeOzvv8BaQCeszRdZMXOSWj1/DkOjA+fnLt5OvzpON7YCvQ4TjAL/CKw3KTb tiZ5Qsc2nxcwipmctBgc8QfhLtY/9Zrgr7lcUTkccenFmRkT8yvO3lkmbega+k7Fuf8d ZfC0+UivtISt0KuEJCMR0+NpSS99CdQipirrlaaHHnx5c/bu+b6tFyNyDqQV+u4wZP/5 Vn1g== X-Gm-Message-State: AEkoousaOTMQY3IgrGgpDTM6oC//KtABKwks1+kuYES/uuQP/+a1tNb+kehchoFjf9iq/840JEYeUvIHS0npgQ== X-Received: by 10.107.2.78 with SMTP id 75mr52487280ioc.128.1469993485978; Sun, 31 Jul 2016 12:31:25 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 31 Jul 2016 19:31:16 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a113946588de1f00538f3875f Subject: [RFC] E_NOTICE for invalid array container From: dave@mudsite.com (David Walker) --001a113946588de1f00538f3875f Content-Type: text/plain; charset=UTF-8 Hi All, I'm attempting to get involved and hack away at some internals; I figured the best method to do this would be to pick up a bug and do my best at it. So I grabbed #37676. The issue asks to implement an E_(NOTICE|WARNING) when attempting to access scalar values as arrays. cmb alerted me to a long thread that came up last year ( http://marc.info/?t=143379796900001&r=1&w=2). I've read over it and the couple of other PR's that attempted to resolve this issue. As I read, the couple of major complaints about adding an E_NOTICE were that multiple-accesses in a set (i.e. $a=false;$a[1][2][3];) would produce too many errors. Matt raised this issue, in addition to it only being raised for non-null issues; having NULL be an 'identity' of sort that any array access on a NULL is NULL. I agree with him in part, and oppose in others. I think that original access to a NULL should be treated as accessing any scalar value, however I do agree that multiple notices would be bad. Rowan has also presented his thoughts to the same, and this implementation takes into account his solution where we don't raise much. Christoph countered that: ```$o->foo->bar``` would itself raise two notices rather than one. I would present that that behavior should be pruned itself. Object access on a null should alert, but subsequent calls ought not to (I don't know how to prevent that, but then again I haven't learned). So I want to solicit for more discussion given previous talks. My first-attempt RFC for this is at: https://wiki.php.net/rfc/notice-for-non-valid-array-container -- Dave ps: this is my first attempt here at an RFC solo, and preemptively apologize if anything deviates from the norm too far, did my best to follow all them how-to's. --001a113946588de1f00538f3875f--