Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106997 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15372 invoked from network); 12 Sep 2019 20:33:55 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 20:33:55 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 7ABAD2C0459 for ; Thu, 12 Sep 2019 11:09:52 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Thu, 12 Sep 2019 11:09:51 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id y62so16823555vsb.6 for ; Thu, 12 Sep 2019 11:09:51 -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=Zbc1NRQotZ3HMA4qNrpJhc0fVM31P9XVPn7wO5/nGLs=; b=htGOC6Vt+BYcPPgE1oGB26H4Z5tWnp8IRjMDIKLeU321WhBi726GHQjoTVpbEsLpNb HxtWc5orYHYhhI/QaiWSpv6HjaocRNLerVeR8RaTgWb3C5BUL5rildKsb4Vmn3QoHS4z d6hbwq9qdx77byl8l6h5kg6ne/ihwhRUk9arGoEdu3I56an28hZBPGSPo1kIE/7RgMxo 5w9Eaea4bS6QfzfrVf6BDo6dTofB+R2KC9gCvWt9MS1C8ZTQNmAoLC6G19EALvClK0y+ H8WXT04MQCA+XnNYdwDAQBUPHYnf9CUwT7DnQ+my1jWCOGDZJ5Otf4byIJDsw8BQgp0D F2wg== 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=Zbc1NRQotZ3HMA4qNrpJhc0fVM31P9XVPn7wO5/nGLs=; b=qiVrISs+eeuFod904JRkNDdjc1qvKVfCYnRiaSgPnpCJhuNPl7proDZ4ArfQ5Jeptb zOcYN9SKL05VzYZszwtIeWlsLNCbF0nx1Nj/ldEC06K4+9U2EWRBa3J7jYP6oepXfL6d RTPxAlwOaZeAGzPeqOT/7i/GGXrsPQxxE1l/byolI3JDg+10X1e2BUxjUUWlb13MgqNS qI/eGzg18p6/G47ABSXcP8xsso1PzTnE0x4KFBMMq9IY5Krpb+YDt2q9Dnxx019DNyAy gRJ4aEhTlPe0qpbo4y+aXMToOchHCxNW6Yal2YZGLpzKONmK7SXoLb7bbYx4j0+16vt4 0EWA== X-Gm-Message-State: APjAAAUWD3ObtJa3n+Xai+zD8UAGrtQYhYR4lCFiEsbcJn8ZVhIBnkZr qm6hl9Ly0JcTox7ibqGO3QN3luSZIXwLCx8Q/Is= X-Google-Smtp-Source: APXvYqxVDT/PtLNG5Cmcmv58PmM8Zyv/i7DOVa82ZAaiZ8KdvLhuia7Ba6bFmPNiVU5Asjy/TV+F/BfR8Il03vtQUOY= X-Received: by 2002:a67:f9c8:: with SMTP id c8mr1348149vsq.126.1568311790561; Thu, 12 Sep 2019 11:09:50 -0700 (PDT) MIME-Version: 1.0 References: <076701d56978$86020910$92061b30$@php.net> <078e01d5697c$5512bc10$ff383430$@php.net> <31BD63BC-ACE0-4478-B241-E698D2D6F59C@newclarity.net> In-Reply-To: Date: Thu, 12 Sep 2019 14:09:39 -0400 Message-ID: To: Olumide Samson Cc: Mike Schinkel , Lynn , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000002c6dee05925f0b35" X-Envelope-From: Subject: Re: [PHP-DEV] Changing fundamental language behaviors From: chasepeeler@gmail.com (Chase Peeler) --0000000000002c6dee05925f0b35 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 12, 2019 at 2:07 PM Olumide Samson wrote= : > I think it would do this list more good than not, if we talk or assume > about some people who will ever or never upgrade... > Seriously? > How do you know if they would never or ever upgrade, you can only and > should probably speak for yourself... > > If they want more customers(translating to revenue), they can upgrade and > if they don't it's all up to them... > > On Thu, Sep 12, 2019 at 6:59 PM Mike Schinkel wrote= : > > > > On Sep 12, 2019, at 10:37 AM, Lynn wrote: > > > > > > On Thu, Sep 12, 2019 at 7:22 PM Chase Peeler > > wrote: > > > > > >> There are valid reasons for not always initializing variables or arr= ay > > >> keys. It might be a bad > > >> reason in your opinion, but others view it as perfectly acceptable. > > >> > > > > > > I recently had to fix a bug where a variable was renamed, caused a > merge > > > conflict and resulted in months long of changing a business process > with > > a > > > subtle bug, as null was not the intended initialized value. Whether o= r > > not > > > people should initialize variables is debatable from a programming > > > perspective. From a reader's perspective it's really important to hav= e > > > variables initialized with a default value, even if it's just null, t= o > > > prevent missing certain assignment branches and avoid bugs. From my > > > perspective, this should've thrown an error, so we would've fixed it > the > > > same day. Now PHP simply broke our business process for months. > > > > > > Yes, we hide notices, even in production as our logging server would > die > > > within a minute if we'd turn it on. Yes, this is a massive legacy cod= e > > base > > > where lots of tests are lacking. Can we change this? Sure, will take > > years > > > though. Would we have benefited from PHP throwing an error in this > case? > > > Most certainly, would've saved us a lot of headache, and money. > > > > > > You argue that it's a fundamental language change, I -and seemingly a > lot > > > of others- argue that this is more of a bug fix. > > > > Just a few weeks ago I was refactoring some particularly horrible code > > developed by previously employed developers =E2=80=94 a code based that= has a > 1400 > > line function and many other functions 100s of lines long, and I added > some > > initialization for variable and array elements prior to their use. > > > > Unfortunately my changes broke the code because the original developer > > using isset($var) as branching criteria. After finding this bug, I > > realized that this code base uses that technique frequently. I am know > > from lots of experience that this is a common technical among WordPress > > plugins. > > > I think they could switch to using null instead, or perhaps get something > else to differentiate what they have initialized or not, that shouldn't > stop them from using PHP, probably it will only make them not upgrade to > PHP if they think their bad coding practice is the way forward and the be= st > way to code.. > > Can you please stop speaking for what you think they should do? Only they can speak for what they should do. > If PHP8 were to change to require variables and/or array elements to be > > initialized then this code base and any similar to it will be broken. > > Companies with these code bases almost certainly will simply not upgrad= e > to > > PHP 8. Probably ever. > > > > This is merely assumptions and you can't speak for companies you don't > know, what's the statistics backing these your use of "ever and never"? > > > > BTW, prior to gaining this company as a client, the internal people fel= t > > that the codebase needed to be completely rewritten rather than > > incrementally refactored. And because rewriting would have been such a > > large project they have been putting it off for several years. In thei= r > > case, we will be cleaning up the code base (although doing so will be > very > > costly for them.) > > > > And I estimate there are a large number of similar scenarios in the wil= d > > that do not currently have plans the people or the funds to clean up > their > > similar code. > > > > It's up to them, PHP 7 is still available and will always be available > for > them to use... > > Yes, but, there are going to be other features in PHP 8 that won't break existing code and are beneficial. They may be forced to stick with PHP 7, but don't act like that is a perfectly acceptable option without any downsides. > > #jmtcw > > > > -Mike > > > > > --=20 Chase Peeler chasepeeler@gmail.com --0000000000002c6dee05925f0b35--