Skip to content

fix: pass log messages as an argument, not a format - #265

Merged
jmjoy merged 1 commit into
phper-framework:masterfrom
brettmc:fix/log-format-string
Nov 1, 2026
Merged

jmjoy merged 1 commit into
phper-framework:masterfrom
brettmc:fix/log-format-string

Conversation

@brettmc

@brettmc brettmc commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

output::log handed the message to php_error_docref1 as the format string. A message containing "%s" crashed the process, and "%%" was collapsed to "%". The macros take Rust format syntax, so authors had no reason to escape anything.

Call php_error_docref with a "%s" format through a wrapper in php_wrapper.c. The function is a macro before PHP 7.4, so the wrapper keeps one code path for all versions. php_error_docref1 is removed in PHP 8.6, so this also clears one build error there.

Assisted-By: Claude Code

output::log handed the message to php_error_docref1 as the format
string. A message containing "%s" crashed the process, and "%%" was
collapsed to "%". The macros take Rust format syntax, so authors had
no reason to escape anything.

Call php_error_docref with a "%s" format through a wrapper in
php_wrapper.c. The function is a macro before PHP 7.4, so the
wrapper keeps one code path for all versions. php_error_docref1 is
removed in PHP 8.6, so this also clears one build error there.

Assisted-By: Claude Code
@brettmc
brettmc force-pushed the fix/log-format-string branch from 848e7da to 41db81c Compare November 1, 2026 06:25
@jmjoy
jmjoy merged commit 64deb31 into phper-framework:master Nov 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants