Re: Changing fundamental language behaviors
| From: | Olumide Samson | Date: | Thu, 12 Sep 2019 18:13:24 +0000 |
| Subject: | Re: Changing fundamental language behaviors | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107000@lists.php.net to get a copy of this message | ||
On Thu, Sep 12, 2019 at 7:10 PM Lynn <kjarli@gmail.com> wrote:
> On Thu, Sep 12, 2019 at 7:59 PM Mike Schinkel <mike@newclarity.net> wrote:
>
> >
> >
> > Just a few weeks ago I was refactoring some particularly horrible code
> > developed by previously employed developers — 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.
> >
> >
> 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 = 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.
>
> even without a statistics to back the word is plainfully meaningless...
I guess we tend to use the word
"HUGELY","NEVER","EVER","COMPANY", etc
wrongly on the list just to prove some points.
And, we're better off than that IMO...
> Regards,
> Lynn van der Berg
>