php / php-src

The PHP Interpreter
https://www.php.net
Other
37.97k stars 7.73k forks source link

error formatting inconsistency regarding spaces #15857

Open staabm opened 6 days ago

staabm commented 6 days ago

Description

running automated tests in private repo, I recently noticed that some error messages contain more spaces then other (macos vs. ubuntu github action)

The following code:

<?php

function subtract_no_lint($m { // intentional syntax error
}

Resulted in this output: (note 2 spaces after Parse error:)

Parse error:  syntax error, unexpected token "{", expecting ")" in does-not-lint.php on line 3

But I expected this output instead: (note 1 space after Parse error:)

Parse error: syntax error, unexpected token "{", expecting ")" in does-not-lint.php on line 3

I saw similar differences in the php-src testsuite, see e.g.

grafik

PHP Version

8.3.11

Operating System

ubuntu / macos

cmb69 commented 6 days ago

There are multiple such issues in https://github.com/php/php-src/blob/master/main/main.c, and maybe more in other files. I wouldn't call that a bug, though, but improving the error messages might be a good idea for PHP 8.4.