vsprintf() Returns Empty String On Error¶
vsprintf() always returns a string, or raise an exception. Until PHP 8.0, it used to return false in case of error.
PHP code¶
<?php
var_dump(vsprintf("%04d-%02d-%02d", []));
?>
Before¶
Warning: vsprintf(): Too few arguments in /in/1pYdW on line 3
bool(false)
After¶
Fatal error: Uncaught ValueError: The arguments array must contain 3 items, 0 given
PHP version change¶
This behavior changed in 8.0