Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114599 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89528 invoked from network); 25 May 2021 19:36:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 May 2021 19:36:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 222F81804B0 for ; Tue, 25 May 2021 12:47:46 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 May 2021 12:47:45 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id b12so32505528ljp.1 for ; Tue, 25 May 2021 12:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tSXT1OmQz6WeaxQHOAyczNPwV3yrEVCcWhOphhrVQTo=; b=nHsQtF3LHdVyTaxLl44b15loo5FwiWo5pJQFOG5oHmcorjsUp/PywnvYsr6mx22u1y pBSU4fhsI969pwN4BPaKERXb/J7VScVPYq6K5aYg11q2vB21VPU64cBP52IXRlCh/f9C BqYmNChBOwtHBJc0GCQrow+ZHE41W8nJgKaqIMoehsvd/UIzrttMFxlMHWbDyxma+kSy rOCQ1muQKy+EB/5JEK7iqjMIM85hBm444eN3DajQCoMMweJ4nK3+ER5kyieyr5+XFToq DqPRIar/qNOyXpwIw6mWfLO8HvTEBLeT6F/zjzhf4PSnS+SH+z3c4Zr4DJ1MScyfdGJI 1S9g== X-Gm-Message-State: AOAM532ki7XSIVKMRy1gLIQGAIH0lQUNzwqk253MnDZeRqPdOCIhG0VN /qS5jMwIp7XxQ5Y0awX72+6ADvFmbmQOOvcM5z6Dbg== X-Google-Smtp-Source: ABdhPJzgGR0Dsk+MQ41VczmpuC3BlZMQEDFFBAx0O3GmGpRahVTzSh5ZNdUW6gp/H+NCh2eVGKJPhFxZ+wJDwyyTAxc= X-Received: by 2002:a05:651c:502:: with SMTP id o2mr22100564ljp.105.1621972063849; Tue, 25 May 2021 12:47:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 25 May 2021 14:47:33 -0500 Message-ID: To: Kamil Tekiela Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000b3a27505c32ccc82" Subject: Re: [PHP-DEV] Disable autovivification on false From: pollita@php.net (Sara Golemon) --000000000000b3a27505c32ccc82 Content-Type: text/plain; charset="UTF-8" On Tue, May 25, 2021 at 11:23 AM Kamil Tekiela wrote: > I'd like to start a discussion on the following RFC > https://wiki.php.net/rfc/autovivification_false > Particularly, I am looking for opinions on whether this behaviour should be > left alone, should be disabled on false, or should be disabled on null and > false, and left only for undefined variables. > > Autovivification is very useful in PHP, especially with multidimensional > arrays and loops. However, the question is should we allow it on false and > null values going forward. > > I agree it's useful, and should 100% not be killed on undef. There is doubtless a mountain of code in WordPress plugins alone which relies on this, not to mention other frameworks and libraries. As for `false` and `null`, I think it's reasonable to kill these (with a deprecation period) in a major version (e.g. 9.0). It might also be reasonable to only kill this behavior when strict_types is enabled. Essentially it would enforce making the array type accessors strict about operating on arrays. Would still need a deprecation period to go with that, but it would be less-rough on migrations of legacy codebases. -Sara --000000000000b3a27505c32ccc82--