Skip to content

Zend: refactor various INI parsing aspects - #23893

Merged
Girgias merged 5 commits into
php:masterfrom
Girgias:2026-09-ini-scanning-mode-enum
Oct 19, 2026
Merged

Girgias merged 5 commits into
php:masterfrom
Girgias:2026-09-ini-scanning-mode-enum

Conversation

@Girgias

@Girgias Girgias commented Sep 24, 2026

Copy link
Copy Markdown
Member

Pack struct, define a new C enum for scanner mode, and use this new enum as a type.

@Girgias
Girgias force-pushed the 2026-09-ini-scanning-mode-enum branch from 3a1778a to ad052d7 Compare September 24, 2026 18:23
And move error handling to the call sites in PHP_FUNCTIONs
It now always returns SUCCESS, and propagate the voidification chain for call sites of init_ini_scanner that now always return SUCCESS.
@Girgias
Girgias force-pushed the 2026-09-ini-scanning-mode-enum branch from ad052d7 to 02b210b Compare September 24, 2026 19:22
@Girgias
Girgias marked this pull request as ready for review September 24, 2026 21:24
@Girgias
Girgias requested a review from bukka as a code owner September 24, 2026 21:24
@Girgias
Girgias requested a review from arnaud-lb September 29, 2026 13:54
Comment on lines +2507 to +2511
/* Sanity check */
if (UNEXPECTED(scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED)) {
php_error_docref(NULL, E_WARNING, "Invalid scanner mode");
RETURN_FALSE;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was hoisted from init_ini_scanner(), but this could be turned into an exception as per https://wiki.php.net/rfc/policy-exempt-type-value-error-bc-policy ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to do this as a follow-up PR. :)

I wanted this one to be mainly be refactoring without behavioural changes.

@Girgias
Girgias merged commit 3d84b8f into php:master Oct 19, 2026
18 checks passed
@Girgias
Girgias deleted the 2026-09-ini-scanning-mode-enum branch October 19, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants