On Thu, Sep 12, 2019 at 7:59 PM Mike Schinkel <m...@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. Regards, Lynn van der Berg