php-src
php-src copied to clipboard
Omitting a parameter in printf() doesn't create Error
Description
The following code:
<?php
printf(
'my test',
);
Resulted in this output:
my test
But I expected this output instead:
Parse error: syntax error, unexpected ')' in /in/NfddB on line 4
Process exited with code 255.
In the example the second parameters has been omitted and from PHP7.3, it doesn't create any error. I think the PHP7.3 behaviour should be restored.
PHP Version
PHP 8.0
Operating System
Ubuntu 20.04
test made:
https://3v4l.org/NfddB https://3v4l.org/NfddB#v7.2.34
PHP allows trailing commas in function calls since PHP7.3. https://wiki.php.net/rfc/trailing-comma-function-calls
Thus this actually is a feature, not a bug. :wink: