[php-src] Issue #10260: Whitespaces before curly bracket in accorders to PSR-12 randomly throws parse error

From: Date: Sun, 08 Jan 2023 13:09:13 +0000
Subject: [php-src] Issue #10260: Whitespaces before curly bracket in accorders to PSR-12 randomly throws parse error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243366@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10260 Author: alejandrodecap ### Description The following code: ```php if($n <= 3) { echo 'ok'; } else { echo 'not ok'; } ``` Resulted in this output: ```php PHP message: PHP Parse error: syntax error, unexpected token "echo" ``` But I expected this output instead: ``` 'ok' or 'not ok' ``` If the echo is removed the output is: ``` PHP Parse error: syntax error, unexpected token "}" ``` When the whitespace before the first curly bracket is removed the error disappears. If the whitespace is then returned, no error is thrown. This error has appeared in if, foreach, and while-statements ### PHP Version PHP 8.1.13 ### Operating System Debian GNU/Linux 11

« previous php.bugs (#243366) next »