On Thu, Sep 12, 2019 at 7:22 PM Chase Peeler <chasepee...@gmail.com> 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 merge
conflict and resulted in months long of changing a business process with 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 the
same day. Now PHP simply broke our business process for months.

Yes, we hide notices, even in production as our logging server would die
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 lot
of others- argue that this is more of a bug fix.

Regards,
Lynn van der Berg

Reply via email to