Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114762 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96413 invoked from network); 7 Jun 2021 10:03:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jun 2021 10:03:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B95E31804C9 for ; Mon, 7 Jun 2021 03:18:17 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 ; Mon, 7 Jun 2021 03:18:17 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id s22so1005895ljg.5 for ; Mon, 07 Jun 2021 03:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eLB9kNVITN2fmmPro7nOQeZI7z1w9qLCUxIU8xCWQT4=; b=q8uuniAdEijW9VMnOPgT3mpnFAKaQZsuYp1kcYjQdqG57NwZJ2IW8IVKAm9AbHvO87 QU31LKekIDpqU5FcblSpW0oAhoPnmVdX4bhSMVrIP5yMMMiNcwnJNzcH5ifGZ5GsovZb +5LebqdVGndA4QYdXKUYvXsp2WR7gnMQnPG0elnUzHXa2j69Zp9/aZYP0eHmu6SNI79c lgBd6nl+sRV9ilr+wja4dJ6XwVxneoAX7nIN/3LswxLNiaM5nFg7sz/M6XbjNAyupJI0 EgbeGPqYg9rdQmcUpn0G/AIw+JjdfXLtjfSFrd9VKLGghpApMrxiQDLdP4WakWmWfjPX XRYA== 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=eLB9kNVITN2fmmPro7nOQeZI7z1w9qLCUxIU8xCWQT4=; b=EStIWbTAyxfzhADIPNURECasdGh6usINbGa2idnPhyvp02iHGgBJnfOVBvL8Fzs2u0 lSuKxr4tBT6i3nOkJ49PlgdXLjJ0jr2aIH2WENaNBR4bvCZzUoS/6Ax1T5VkWE+Gy2jp cxEwwwrnG/FMv40HlzIdmzudHc/P+6c3yOf7mnO7uh/6Fg41WvZQd+ZMfI+NXAABeX7r tsh/VPrUfgQP4tBmb97sXxEYfXA08amz2hWNskovX6YMf/eGrQedRYID/MYLJY1PPxWm SRoYaJ9JfXcvbmsTGfaDA1oiFTffhqF87YQSipbhvrvVKmdfTW6S2n8aYXgHv9HnPa2j hn2A== X-Gm-Message-State: AOAM530rzqnWfbgk+0hkowiyCk/MHLXlbtjOsOzswXs+1LRa5xp6DibH 4rKIPrzugQm+RJE/qtRU+wmniq/ODFFdtXlVHWQ= X-Google-Smtp-Source: ABdhPJxKB7JaBB+BbRsZdNR1gCXMTzM9W/7q27zDDT8OaI6E96kdEvXBM+8WWGzxB7V2Juko+W/tjufpExfzUHbTn3Q= X-Received: by 2002:a05:651c:604:: with SMTP id k4mr12078650lje.244.1623061095475; Mon, 07 Jun 2021 03:18:15 -0700 (PDT) MIME-Version: 1.0 References: <7DC82988-16E1-4228-BF94-46E633BD116E@woofle.net> In-Reply-To: Date: Mon, 7 Jun 2021 12:17:59 +0200 Message-ID: To: tyson andre Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000000b6d8305c42a5c8c" Subject: Re: [PHP-DEV] Disable autovivification on false From: nikita.ppv@gmail.com (Nikita Popov) --0000000000000b6d8305c42a5c8c Content-Type: text/plain; charset="UTF-8" On Sun, Jun 6, 2021 at 12:14 AM tyson andre wrote: > Hi Kamil, > > > I have reworked the RFC based on some feedback. The improved RFC now will > > hold 2 votes. One vote to decide whether the behaviour should be > deprecated > > from false, and another from null. > > > > If there are no objections then I would like to start the votes in a > couple > > of days. > > > > However, I would still like to hear from you whether you > > use autovivification from false and/or null in your projects. So far, I > was > > not able to identify when this would be useful in real-life scenarios. > > > > RFC: https://wiki.php.net/rfc/autovivification_false > > Without an implementation it'd be hard to actually tell what the impact > would be. There isn't one linked to from the RFC or on > github.com/php/php-src. > You might have code in your application or external dependencies that > relies on that without you remembering or being aware of it for null. > > **I started working on a prototype independently just to get an idea of > how many things would encounter deprecations. See > https://github.com/TysonAndre/php-src/pull/17** (I am not one of the > RFC's authors. If someone bases their implementation on that prototype PR > please keep the authorship of initial commits (e.g. `Co-Authored-By` in git) > > Also, what is the planned deprecation message, what about documenting all > kinds of expressions that can cause autovivication, etc: e.g. `$x = > &$falseVar['offset']` > > > My assumption is that false would be reasonably practical to implement > (this patch with `== IS_FALSE` instead of `>= IS_NULL`, plus some changes > to the optimizer to account for the fact some dimension assignment > statements might now have. > For IS_NULL, that would probably require more familiarity with php's > internals than I have to be certain the implementation is correct and to > properly distinguish between undefined and null when automatically creating > properties. > This is a good point. After a cursory look, it's not obvious to me how we could distinguish these cases. We do need to perform the null initialization here, as we can't just leave behind an undef element in the property table. I think it would be best to limit this proposal to the false case only. A way to put this is that auto-vivification only happens for !isset(), which is precisely undef or null, but not false. (The historical behavior was that it happens for empty(), which has been cut down over time to the point that false is the only other accepted value, at which point this framing doesn't make sense anymore.) Regards, Nikita --0000000000000b6d8305c42a5c8c--