[php-src] PR #24510: Fix GH-11709: Line breaks in quoted strings fail with INI_SCANNER_RAW
| From: | cgsmith | Date: | Wed, 21 Oct 2026 21:19:19 +0000 |
| Subject: | [php-src] PR #24510: Fix GH-11709: Line breaks in quoted strings fail with INI_SCANNER_RAW | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39678@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24510
Author: cgsmith
Fixes GH-11709.
With
INI_SCANNER_RAW a quoted value containing a line break failed to parse.
INI_SCANNER_NORMAL and INI_SCANNER_TYPED handle it fine:
```ini
b="line 1
line 2"
```
The raw value rule in zend_ini_scanner.l always stopped at the first newline. The value
became "line 1 and the next line was parsed as a new key. This was either a syntax
error (as in the issue) or silently wrong keys, e.g. b="open\nz=1" gave
b => "open and z => 1".
The raw scanner now keeps reading past a newline once inside a value that started with
". So long as a closing quote exists later. Line numbers are still counted for the
consumed newlines.
An unclosed quote keeps today's behaviour so input like the following still parses the same
way:
```ini
b="open
z=1
```
Tests:
- ext/standard/tests/general_functions/gh11709.phpt: the issue's case, CRLF, a
trailing comment, the unclosed-quote case and line numbers in later errors. Raw results match
INI_SCANNER_NORMAL.
- Zend/tests/bug69551.phpt: its input is exactly this pattern, so its expected output
changes from the syntax error to SubnetMask => "\n" which is the same as
normal mode. The original crash (a lone ", guarded by yyleng > 1)
is no longer reached by that input, so I added a lone quote case to keep covering it.
Targets PHP-8.4 as the lowest branch in active support.