Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106998 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16717 invoked from network); 12 Sep 2019 20:34:28 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 20:34:28 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 317B02C7E17 for ; Thu, 12 Sep 2019 11:10:25 -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-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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:10:24 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id d17so35073182ios.13 for ; Thu, 12 Sep 2019 11:10:24 -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=FOATtXgkS8ax/MaanwMh4fW2SgVbkv8AVtDuJIbN/sk=; b=oIsILYlGRBTaYrCJe/etJMSe917Io0/Iv2VUu0bZbusnyioE73PJtKpG2QBjutNh/W uawF/7zAVS/9M62ngAOyUOOOjFSbBflAa7PCeG6uL8EX90A86IfVJ+x/VHAELmF49GMM qs1F84HK2YXthBcuB4hV/l26mXs4ACcsZR4ydqsgnVxO3DyTTY/InOvsrbiIH9AXJJA6 QPIB94SC2b1sp9W8eU0uOEtRLtlHmDOGxtre51DN/1i1m+j1SIvzoMd63v/MczdQ/nQ7 NOWPqOGGWZgXERhtMXfAVGCR/WqqED/nXXbbcpOHxRVTIUqCzIBC8JHL6HG+hDVBLqwB WleQ== 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=FOATtXgkS8ax/MaanwMh4fW2SgVbkv8AVtDuJIbN/sk=; b=hJKKyq/86mm2m0xSrdoym/oE68zEYgNKHiBo5ErlhOO13ImkDUnBztcsY5j3iLVVS2 0uMVVxAK9n9diP7kZbrcmZcH9OSD6CD9v9kjRaQzCctiasa55+x9GESfXZ/kwGfV1J6G dRdr2TMkaCilW5I9eq4nsjQ8nv8rBAPdZa/OTKtcQycudO+OspHcKozX9AsixphVEzFy y5kOFLnBIdS7qJkOlsF7WP4qXi1zasZdUeW2bTXeJRFJOeIqm/8SmATWOJA9WpHE+VGZ xAkZ97EeKxrK7T1eWpVLYRrxo+xTGJ5aW3qpuAwkuPMwvXb/sfCtlRtgod3INBf6H+Dg GODw== X-Gm-Message-State: APjAAAXanHBlYjZPs68G9QbOW82whoKAFB9vDGmT74/XfsVYqk66YNv7 WcefMwMpu0XpxvDZDsTah4XlLFGCswtPSs/DSz9WqBl98WM= X-Google-Smtp-Source: APXvYqwjq6LCUIC6cbZK9Utkspt/vUtwFyEszf9TN0cecoup1BeIp9MuiPvF2OkHVI/KlJ+cY+TJJ26DO6y9dW0dYIY= X-Received: by 2002:a05:6638:953:: with SMTP id f19mr46663040jad.86.1568311824078; Thu, 12 Sep 2019 11:10:24 -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 20:09:59 +0200 Message-ID: To: Mike Schinkel Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000002bdd7705925f0d03" X-Envelope-From: Subject: Re: [PHP-DEV] Changing fundamental language behaviors From: kjarli@gmail.com (Lynn) --0000000000002bdd7705925f0d03 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 12, 2019 at 7:59 PM Mike Schinkel wrote: > > > 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. > > The bug is not that you initialized the variable, it's that you initialized it with a different value: https://3v4l.org/8mB8B ``` var_dump(isset($a)); $a =3D null; var_dump(isset($a)); // gives bool(false) bool(false) ``` Whenever one of these errors will occur, you can initialize either the array key or variable with null and it will work again without changing behavior. If anything, Wordpress shouldn't be an argument to not improve PHP, though I think it's important to consider the impact of a change, including for the Wordpress community. However, I think most people agree that the quality of Wordpress code and Plugins is highly debatable. I don't like the idea of not being able to progress because Wordpress users won't upgrade PHP. Regards, Lynn van der Berg --0000000000002bdd7705925f0d03--