php - Why did PHPMailer just change from using dynamic function calls to call_user_func()?

one text

Solution:

Since this is so specific, it would probably have been better asked on Github, but I'll answer it here.

This was done for a very specific reason; switching to variable functions (which was done in PHPMailer 6.1.2) caused a very specific BC break in PHP versions between 5.2.3 and 7.0.0, and that was reported to me. While those PHP versions are now considered defunct, many are still using them, and the current PHPMailer release (6.x) promises compatibility back to PHP 5.5, so this change needed be reverted to retain compatibility with those old versions. It has no effect on later PHP versions.

I originally changed to variable functions because, as you say, it's the new shiny, it's easier to read (IMHO), and it's the kind of thing that gets recommended by static analysers, however these (evidently!) don't take backward compatibility into account.

So what was the BC break? While variable functions themselves have been around for a while (since at least PHP 5.4 I think), the static method callable pattern (class::method) was only added in PHP 7.0.0, whereas that syntax works fine in call_user_func; that's exactly what the BC break was, and the reason for the reversion in the PHPMailer 6.1.7 release.

Source