I have spent an hour today debugging a weird issue: PHPUnit complained that it tried to call an undefined function PHPUnit\Framework\Assert\assertEquals():

Because I’m currently working with custom PHP extensions, I suspected the worst: the code corrupted PHP’s internal memory somewhere, and, luckily, it damaged only allocated memory.
Of course, tests under Valgrind did not show anything. When I commented out some tests, everything worked. I checked every function again and again, but to no avail.
And then I looked at the function name again: PHPUnit\Framework\Assert\assertEquals(). assertEquals has turned into a function, but it used to be a method (a public static method). Very interesting. I scrolled up the code to the test `setUp()` function, and my eye caught this:

Eclipse, in its infinite wisdom, decided to alias PHPUnit\Framework\Assert\assertEquals() as strlen() and mb_strlen(). It did that automatically, and I missed that change.
That was a callous joke.
What have I learned from this experience?
- Automatic (especially when they are silent) code fixes are evil.
git diffis your friend.- Trust yourself more: not all bugs are your fault 🙂