Comment

Snarky Puppy: "Take It!" (Feat. Bernard Wright)

56
sizzzzlerz9/30/2022 12:37:54 pm PDT

re: #40 Charles Johnson

PHP 8 is getting on my last nerve with all these “undefined array key” and “undefined variable” warnings.

I liked the way PHP was lenient about referencing undefined variables and array keys, goddammit. It was a feature, not a bug. Fixing all the warnings means a lot of extra code to check if the variable is set before referencing it.

Before I retired, I had 43 years of programming experience under my belt. I think one of the top 5 things that really pissed me off when trying to fix or upgrade legacy code was that the original programmers or later maintainers left it so that the compiler would generate pages of warnings. Since I didn’t know if they were meaningful, it was necessary to investigate each and every one. I can’t tell how many hours were consumed by this. Had someone taken the time to insure that a clean compile would occur, hundreds of man-hours might have been saved. A compiler generates these warnings for a reason. On all newly developed code, I would insist that the compiler be set to treat warnings as errors thus forcing the developer to fix them before the code could be checked in. I may have received some dirty looks but my legacy is future legacy code that compiles cleanly and makes some poor developer’s life easier sometime down the road.