php / php/php-src

Bad error line and file for invalid "-d" arguments

Open
#20,871 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

The following code:

php -d 'foo=bar=asd' -r "echo 'hello' . PHP_EOL;"

Resulted in this output:

PHP:  syntax error, unexpected '=' in Unknown on line 6
hello

But I expected this output instead:

PHP:  syntax error, unexpected '=' in -d option on line 0
hello

Not sure where it gets that line 6 from, and the "Unknown" could also be improved

PHP Version
8.5
Operating System

No response

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

Reproduce the issue with the shown php -d 'foo=bar=asd' -r command and inspect the PHP CLI handling for invalid -d arguments. The work is done when the diagnostic reports -d option and line 0 while the command still prints hello.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.