jimc wrote:
Go on - 'fess up a dirty story...
There's no story, per se. Older versions of PHP were generally silent about casual use of an undefined variable. It was fairly common PHP practice (for years and years) to see statements like:
if ( $flag )
// do something
...when $flag hadn't been set. Often, it was quite deliberate -- set a variable to something when it's appropriate, and leave it undefined otherwise. PHP has never been what I would call an exacting language, or a particularly pedantic one. Quite the opposite.
But starting with PHP 8, the keepers of the language have decided that PHP
is a serious and pedantic language (hah) and have started raising a warning whenever you reference a variable that hasn't been explicitly defined. Which is all fine and good and all, but it isn't the way it's been for a couple of decades of PHP, and so there is a lot of code written with different assumptions. And I am having to fix all of those assumptions (at least, all the ones I haven't already fixed) now, today.
Most of these are innocent and even deliberate cases of an undefined variable. But I'm finding a few where it wasn't intentional, too -- places where code got ripped out but a few stray variables were still referenced in nearby code, for instance. Those are genuine errors. Generally harmless, but still errors.