Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105135 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95241 invoked from network); 8 Apr 2019 05:21:57 -0000 Received: from unknown (HELO mail-pl1-f196.google.com) (209.85.214.196) by pb1.pair.com with SMTP; 8 Apr 2019 05:21:57 -0000 Received: by mail-pl1-f196.google.com with SMTP id b3so6372373plr.7 for ; Sun, 07 Apr 2019 19:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cSJLKAgoBfZ+Tr/f1ghlxT+xCDup5r8lFepxFS3XkqM=; b=Yz6vKt75KiQoPJYXzGl9UOhnj7q5dZk+egL9J7qgEktaBg0yv4q5MQ0vfZviTYKC5o J1byNzg/MfcU9DVc5rG4MRhiIfWu+XbX5DQzFCKd+Yt9L402DlcOAAWunc4+UPE/ddST MJZlk2BrDiiUieKY8NgwS1O2IocOdcjulwqm/TpLs2Bk3Zxj7w0kJqJLlKZACziLDLt3 D4XRPaL4P6dZBRKzxsfzWDWeim4LNVBGzGRmBWe6SNfWJVqho9pZKUV9H7HXE5/2z3pY XJ9Y0C6eEpNFVoJf0ShG4NJMaUfsvCEKAHGfw7bQeOEtjqqxUWCp4Hj5B9vVKk5eevWC op6A== 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=cSJLKAgoBfZ+Tr/f1ghlxT+xCDup5r8lFepxFS3XkqM=; b=QKJc3CFs1Jcn1PlY+huKzsi3NMFMcOWuq0jp3oscBjDMeF/RbqxG8f1C8HyzbCpZ1p B3gzPDcAnEwAE0SFedgEGhyokad0il84dFUOqaELjUa7SrxJ97pgGPWlLHfJfHflJWAI I3j0QOwk6GM/t/IXle6lcbGSonbiQiUM0gFMAaShxv8ORrl4Wdd2LWYUUNkzJkSWxgzw pNXF+weWcS42vaTJrwVmFXs3UKnb8d78wBEygmpRZ2bsKdwv7+tRp0vHskG+IeNHa7TZ zZe7c4UOrT2g2xnt+KzXSSVtwLyn3CzPqrSSxpPp9o/KMPnbt3VMk91beFQnjFddB1nE y3+Q== X-Gm-Message-State: APjAAAWs4noJhAY3ketyQfJZvdoHE3AqTdRT9UzgFe/g4jOphgPu3tEG ArlI4GRkZCCqHXyrfWgoPiS/4zthjdDsYwHwQ0XZJw== X-Google-Smtp-Source: APXvYqwMROMVGVsbeXsxHJNLLYuA25eM430wGtHK1nMRsVs93PuR113TYukc/7XSJP1W72US7CjLMyOFM4u2urdg4kI= X-Received: by 2002:a17:902:54f:: with SMTP id 73mr26893729plf.210.1554689908367; Sun, 07 Apr 2019 19:18:28 -0700 (PDT) MIME-Version: 1.0 References: <00b701d4ed5c$27f77550$77e65ff0$@jhdxr.com> In-Reply-To: <00b701d4ed5c$27f77550$77e65ff0$@jhdxr.com> Date: Mon, 8 Apr 2019 03:18:16 +0100 Message-ID: To: CHU Zhaowei Cc: Andrey Andreev , Chase Peeler , Christian Schneider , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] bool values and increment operators? From: Danack@basereality.com (Dan Ackroyd) On Sun, 7 Apr 2019 at 17:08, CHU Zhaowei wrote: > > It there anyone working on this? I'm planning to. I've just been also thinking about arrays and nulls with pre/post inc/decrement. I'm guessing code that is 'intentionally' doing: $foo = false; $foo++; and $foo = []; $foo++; are going to be relatively rare, and so would be small BCs. Whereas code that is doing: $foo = null; $foo++; e.g. through something like: error_reporting(0); $bar = []; $foo = $bar['bad_key']; $foo++; Are going to be more common, and so would be a large BC break. Though seeing as since PHP 7.0 we have the null coalesce operater, that code can be re-written to have an explicit default, and not emit an error as: $bar = []; $foo = $bar['bad_key'] ?? 0; $foo ++; > In addition, I'm thinking whether it's possible and necessary to add a global > strict mode (like "use strict" in js) in PHP 8 to deal with this kind of unexpected > surprise. I know we have declare(strict_types=1) but it only works for functions > and it's limited to call from current file. A global mode wouldn't be good - it would have the same problem as ini settings have; libraries that are written needing one mode, can't be sure they would be used in that mode. An alternative idea of having settings per namespace has been mentioned before with the config settings per library managed through something at the package manager layer, e.g. Composer. cheers Dan Ack