php / php/php-src

error formatting inconsistency regarding spaces

Open
#15,857 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Engine Feature Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown does-not-lint.php syntax error and the related php-src testsuite cases, comparing their output on Ubuntu and macOS. Trace where the parser error text is formatted and update the relevant tests so the spacing is consistent across platforms.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.