Reputation: 3
Ignore the fact that we need to update CakePHP 4 for a moment...
I've had the following scenario happen a dozen times over the last year. Code will refuse to work even though it's perfect, so I add a 'debug' to dump some information, and the code magically starts working. Even stranger, if I remove the 'debug', the code continues to work.
I thought it was just a quirk of my own laptop until a colleague said he added a 'debug' to our online development environment and the problem he was trying to solve fixed itself.
Finally, today I was trying to determine why a SQL-heavy section of code was taking far longer than it needed to and wasn't returning any info. I cleared by cache several times and even rebooted my laptop for maximum freshness – nothing helped. I added a bunch of 'debugs' and ran the code several times, then removed the 'debugs' and now the code is executing in 1/5th the time and it's displaying the data, which is a table of 400 rows with 12 columns each, nothing big.
Does anybody have any idea why adding a debug, reloading the page, then removing the debug, fixes code that was previously non-functional? Is there a way to prevent having to do this stupid trick in the first place?
Upvotes: 0
Views: 51