Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106719 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49402 invoked from network); 28 Aug 2019 14:14:07 -0000 Received: from unknown (HELO mail-io1-f44.google.com) (209.85.166.44) by pb1.pair.com with SMTP; 28 Aug 2019 14:14:07 -0000 Received: by mail-io1-f44.google.com with SMTP id p12so5221051iog.5 for ; Wed, 28 Aug 2019 04:46:15 -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=rtg2ucYshJ5yHfNtVg6yIADqO6wV/kPjqmZPvpEpbRQ=; b=S2sDG2D9cQ/noe1qmWOiqFg3LECfJT1dKgr6RpDWrBm7mgjKd9rvUFZ74Rpc1qSOSy xBnhjc5hXrO1UVVuY4OKw3m04foAomNFW0VKJ0OT8AEer/ag5+raQA5e0DU04b4Hs/k2 eb8yMfQ3QYxNZDG4nbZzrab6XSMDAMrIrD5ZCTMsTG1iUajU6tqxcZBuImJZu4BEC9Er fMzRNLKgyNLEMARik3dMhNGlqAbGYhYebhoqk/44XEtGsBqi1SoEnz1pqcLqrAhVnIeO U/qA+r+b0fxbXdc0vX2T4FHkRTl2IEZQ1cTM1bT5Of2FVKVfhT1kpLV8rdu9mq39wDmF FTFQ== 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=rtg2ucYshJ5yHfNtVg6yIADqO6wV/kPjqmZPvpEpbRQ=; b=uQiz3UnJ6iuIrLzokjeLR89OJEstjeWU1GDzx+845Og80if1zknlF4bJ1ktCNvxRlG 3YrtIsO2l4LzUzxBgM7WzdNN0TeNB/pGCA3qAsDfoh8jh/pUdZ7doNoqnudQtE7qtolp YQjLoGKrX7ENbcWeI5IFpcJOsx+B+eKvYUnTsl+Rsnlk66v4nSyMqbgV9fHVDsoRjK4p 4mmbTWVsyOk1GeSL0Oyk5jzOavYMWOOufPc2UUxjP7sxVN0LcWzJoG3wVeOHEledSUc6 RR6mx5JqUgdsvIeQh+XmzwMrNXYteQcjDVQbHmbaas8kaSy9kyRuXeHJG3QDu8a7de03 2IIg== X-Gm-Message-State: APjAAAV7LDCKgkB0d8bHHaJq7/woTi9cyeSrbBfhIXYXYsEE9RsEQdfe 9yQl203OSiiKPivT1iBD2nIuGe7cv+gbvKCy2zg= X-Google-Smtp-Source: APXvYqzYtiHzZnxmQ7Sapcq8Sb1ChDn5wqxrSpFzzeTHrBNdMEV07oudJXtRrZPq/5NzIL7inbyfnItKDaTC1rFelBY= X-Received: by 2002:a6b:d006:: with SMTP id x6mr3729765ioa.218.1566992775252; Wed, 28 Aug 2019 04:46:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 28 Aug 2019 13:45:49 +0200 Message-ID: To: Nikita Popov Cc: Zeev Suraski , PHP internals Content-Type: multipart/alternative; boundary="000000000000bc119305912beff1" Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: kjarli@gmail.com (Lynn) --000000000000bc119305912beff1 Content-Type: text/plain; charset="UTF-8" This argument makes sense for arrays and objects (and I don't promote > undefined index/property to exceptions for that reason), but I don't think > it holds any water for simple variables. Writing @$counts[$key]++ is a lazy > way to count values and avoid ugly boilerplate for if > (isset($counts[$key])) { $counts[$key]++; } else { $counts[$key] = 1; }. > But @$foo++ is just a really bad way of writing either $foo++ or $foo = 1. > Outside of variable variables, the concept of a conditionally defined > variable just doesn't make a lot of sense. > The variables are not conditionally declared on purpose, but as it's code written 15~20 years ago, maintained, copy-pasted over and over and never reviewed, there's a lot of issues that remain that my trigger an error exception if this proposal is passed without migration path. ``` // a.php if ($someCondition) { // comes from another file, never used, can't verify existance $foo = 'foo'; } // b.php $bar = 'bar'; // scenario1.php include 'a.php'; // this would crash include 'b.php'; echo $foo . $bar; // this would crash if the include didn't yet // scenario2.php $someCondition = true; include 'a.php'; // this would not crash include 'b.php'; echo $foo . $bar; // this would not crash ``` The problem with the above legacy code, which we sadly have spread through a spaghetti of thousands of files, is that if it starts throwing errors with no migration path, we simply can't update without spending possibly weeks debugging and trying to find scenarios where this might trigger. Now I'm not sure, but if I would've used `include_once` and combine this with function/class scopes (people loved to do that in our legacy code), all hell breaks loose and it will be nearly impossible to find the cases. All I'm asking is for a clear upgrade path with deprecations so that my code can be safely migrated over time, rather than have it crash with the next version. Compared to