Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106995 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12444 invoked from network); 12 Sep 2019 20:31:19 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 20:31:19 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 6885D2D1F85 for ; Thu, 12 Sep 2019 11:07:16 -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-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (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:07:15 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id t84so17917413oih.10 for ; Thu, 12 Sep 2019 11:07: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=pj1t4/Q8bFOxpTP8pLhFMy3bCGvfDM762TDbq2EquxM=; b=Pf5IBUHKEAP7HH6+CIJgmj/bNA/dnZmKHi8sHr35HJRPoqIOUyMYf/C7mTQQoYU6dG uBjCKU9Y1Nk6GIEGpXF4koWdtOydngQHKAfukphgI/0WF+1nwAW20Pc59Ak9PtcJ1+NF WQCwp4Mlce0xDpGQ6wK3y+iW+u7a0+pcu4au6k/iEnu+UfrNmUxNknwZVx4xhJruv5lm ZXb/mqAK4fWGWAufxg8hFX5scQPC9ycafgys+X5HPLh8TswVOske17i9sB/DSDzzpTJy 0GJdXuEHlSQuYgnKAxKXt5hzXpNh5YT9My8QA52DdKPDU/A9jae9ux6Rz2m0EgL8gSHH SWyQ== 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=pj1t4/Q8bFOxpTP8pLhFMy3bCGvfDM762TDbq2EquxM=; b=P+cUZUw+1EPz5Eh/fiVrQaoh2f8qAVRMFEPehPp56SxRyw5F52SWX05zdIVBwP7bQ3 RKuP6FV6cnuugbdP7A8n5/LAL6ff6OUo1oboNAo8nq31t/vQZn0M0bWTRXgn9QeLxuCs igxAXKvnEFrFGOI1aw5osHE8zJ15V9YmbdS1kXJMhBoivVvDUYJMQ3+el5btHTM05w+S ZSUqVlRZ4l8nLfIwjR/w/hk/pP/RxpgQUvk3++tV57A7uPiuSt3AwF1CGm3RZsX5+rpr cERJEe1KNrPezD9JPH+xAch8pn6NLbpywRnpqedupMXIt1Cx+cnrV/n4M8x1mTded1Aq bbcA== X-Gm-Message-State: APjAAAUX/t6gG7ksl0yEIMXxmJtgCrNayZA18rMATljGwNoDnl75qpYx AO2YvQgOINrcwcWHbZR/oqnzvfwHX/BRv5cJ4Wc= X-Google-Smtp-Source: APXvYqy5LUMqt5/7TBM/2DqEnB3+NUnLqaAw7Th20CAQ4vkj0jOW6U0zWBOhUDkyJyLFK24WLfWMgn/uXWpvzYwwh8Q= X-Received: by 2002:aca:5294:: with SMTP id g142mr42665oib.44.1568311635308; Thu, 12 Sep 2019 11:07:15 -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: <31BD63BC-ACE0-4478-B241-E698D2D6F59C@newclarity.net> Date: Thu, 12 Sep 2019 19:06:57 +0100 Message-ID: To: Mike Schinkel Cc: Lynn , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000eb769605925f0150" X-Envelope-From: Subject: Re: [PHP-DEV] Changing fundamental language behaviors From: oludonsexy@gmail.com (Olumide Samson) --000000000000eb769605925f0150 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 array > >> 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 merg= e > > conflict and resulted in months long of changing a business process wit= h > a > > subtle bug, as null was not the intended initialized value. Whether or > not > > people should initialize variables is debatable from a programming > > perspective. From a reader's perspective it's really important to have > > variables initialized with a default value, even if it's just null, to > > prevent missing certain assignment branches and avoid bugs. From my > > perspective, this should've thrown an error, so we would've fixed it th= e > > same day. Now PHP simply broke our business process for months. > > > > Yes, we hide notices, even in production as our logging server would di= e > > within a minute if we'd turn it on. Yes, this is a massive legacy code > 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 l= ot > > 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 h= as a 1400 > line function and many other functions 100s of lines long, and I added so= me > 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 best way to code.. 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 upgrade = 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 felt > 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 their > case, we will be cleaning up the code base (although doing so will be ver= y > costly for them.) > > And I estimate there are a large number of similar scenarios in the wild > that do not currently have plans the people or the funds to clean up thei= r > similar code. > > It's up to them, PHP 7 is still available and will always be available fo= r them to use... > #jmtcw > > -Mike > > --000000000000eb769605925f0150--