Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108662 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52849 invoked from network); 18 Feb 2020 22:11:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Feb 2020 22:11:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 88FA418053D for ; Tue, 18 Feb 2020 12:27:41 -0800 (PST) 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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, 18 Feb 2020 12:27:41 -0800 (PST) Received: by mail-wm1-f45.google.com with SMTP id m10so3002843wmc.0 for ; Tue, 18 Feb 2020 12:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:references:from:to:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=0Xt0hjTvM46A5sbPjxx9gqO8vNsGaPaQVxGsSzm3OX4=; b=kY4DuFy36DZEAyjx7uBlf1SSgw2uyv7oJoXejql3tAwCfh3TFmvXZiLDgYn4k5o5NJ fzYJELjhmOWuP0GIYgRDckwMHhPeWmKVt2e2MboPCvLDKIJjDi8Lxlpkm5nCIt7wcYR7 5kfkmS4lne3AOhjxThe+5I8ZfeoMZY/O/K5nVOy8n9IojJ2MIX/KvPpjCtgOHsQ7SB79 rLxy6zC+akI8BSGbMLoxvts8GRUE6Qtt9p3GIz1EXb2YxRfNFmnjcM+IGdaUf9aV8mu+ u6FWBPJH/tisB28Ic2LScO3oY8bu+Hgx3rf2vOl1CXMw3qCLkXivITB0Kig2U5yNDAU1 tXDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:from:to:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0Xt0hjTvM46A5sbPjxx9gqO8vNsGaPaQVxGsSzm3OX4=; b=dbWa3pRQjAT1ce8L0oJd2SdXlQv78wP3/faHBNvbrDarvStk6D/UEiwcElQ4VEuhnx idnRO3uUiyE2qRlEiqNWw3jxm1+k/Z+XI987uWkEBJThGAtZAd3FA0qDsahtBhRy6bsT UUJQp6e934iT8xoj826/u9AneqdOGv7BRAYUyWsSbKMRM61Dvp7MS0MKF5OIRzEawxrW Qp5E8oByi4cd7B5nESDmo+YVFMO933RwaDdf2jbuhkOHlrxO7xIB+1omy17LiiSBAl9p xl17nvNcVfNz/H4PyZEPX+5cVUgzGZfrKJ/m52ExNFidJymd4MNtmpWarBC9mU68GjoB +BTw== X-Gm-Message-State: APjAAAWTUB8yw+kgMGgEs/CT2HfkDPrV0NUgA8fikGFY7v/JI36+Vg4N wVQjpofqJ3aRTwrYHbJo6z0K0xZ3 X-Google-Smtp-Source: APXvYqx0ZwaX1keNPCJmxukkz+OJvCJD44XAYd5myoJ6NM3FQk9tj12BNHTP6XKWjxdSOWS+1fvXEw== X-Received: by 2002:a05:600c:118a:: with SMTP id i10mr5071625wmf.142.1582057659339; Tue, 18 Feb 2020 12:27:39 -0800 (PST) Received: from [192.168.0.14] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id g2sm7357558wrw.76.2020.02.18.12.27.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Feb 2020 12:27:38 -0800 (PST) References: <16481aca-93f4-43f5-5ec2-413d19ade318@gmail.com> To: PHP Internals Message-ID: <660551dc-4527-5f6e-1f05-e167931cd9f1@gmail.com> Date: Tue, 18 Feb 2020 20:27:37 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Allow null variables to be decremented From: rowan.collins@gmail.com (Rowan Tommins) On 18/02/2020 14:00, Nikita Popov wrote: > Principally in favor of this change, I do think that ++ and -- should > behave consistently if nothing else. We might want to consider giving > the same treatment to false/true as well, which should be interpreted > as 0/1. That is $foo++ / $foo-- should behave the same ways as > $foo+=1, $foo-=1 for null, true, false. It seems odd to single out > only "null" here. > > Additionally I would suggest a notice when trying to increment arrays, > resources and objects, rather than just silently doing nothing. As > long as it's just a notice, this should have minimal BC implications. Thanks. That seems a reasonably modest expansion, without getting into the deeper questions of string increments or fatal errors. For the record, the reason I singled out null is that it's the only type where ++ and -- behave differently from each other. With booleans, there is at least a consistency between those two operators, even though it's consistently weird. There's definitely a strong case for making them match +=1 and -=1 though. Regards, -- Rowan Tommins (né Collins) [IMSoP]