[php-src] PR #20899: Fix GH-20871: Improve error message for invalid -d options
| From: | khaledalam | Date: | Sat, 10 Jan 2026 19:12:13 +0000 |
| Subject: | [php-src] PR #20899: Fix GH-20871: Improve error message for invalid -d options | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34505@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20899
Author: khaledalam
## Description
Fixes #20871 by improving error messages for invalid
-d command-line options.
Previously, when an invalid -d option was passed to PHP CLI, the error message reported
"Unknown on line X". This was confusing for users who don't know about PHP's
internal INI handling.
<img width="582" height="129" alt="image" src="https://github.com/user-attachments/assets/fdd44a04-1fbb-4878-98a6-aa4177619100"
/>
## Changes
- Modified Zend/zend_ini_parser.y to detect CLI/FPM -d option parsing
context
- When parsing -d options (filename is "Unknown" and
unbuffered_errors is true), error messages now report "-d option on line 0"
instead of "Unknown on line X"
- Added test case sapi/cli/tests/gh20871.phpt to verify the fix with multiple invalid
syntax scenarios