Skip to content

Fix highlight_string() HTML wire format to match Zend (#24662) - #24750

Merged
PurHur merged 1 commit into
masterfrom
fix/highlight-string-wire-format-24662
Jul 29, 2026
Merged

PurHur merged 1 commit into
masterfrom
fix/highlight-string-wire-format-24662

Conversation

@PurHur

@PurHur PurHur commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Outer wrapper changed from <pre><code style=...> to <code><span style=...> matching Zend
  • Spaces encoded as &nbsp; (Zend behavior)
  • Newlines encoded as <br /> (Zend behavior)

php-src reference

  • Zend/zend_highlight.c — token HTML emission format

Verification

$ php bin/vm.php test/repro/issue_24662_highlight_string_wire.php
OK: contains &nbsp;
OK: no <pre>
OK: <code><span shape

Not covered: full token color parity; highlight_file consistency (shares the same engine).

Closes #24662

Made with Cursor

- Wrapper: <code><span> instead of <pre><code>
- Spaces: &nbsp; instead of literal space
- Newlines: <br /> instead of literal newline

php-src ref: Zend/zend_highlight.c — token HTML emission

Closes #24662

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0ae0f94 into master Jul 29, 2026
@PurHur
PurHur deleted the fix/highlight-string-wire-format-24662 branch July 29, 2026 09:59
PurHur added a commit that referenced this pull request Jul 29, 2026
Default 8.4.0-dev emits PHP 8.3+ <pre><code> with literal whitespace; PROFILE=8.2 keeps the legacy <code><span>/&nbsp; shape from #24750.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Regression: highlight_string() HTML wire still differs — Zend <code><span> + &nbsp; (re-#24288, ext/standard/basic_functions.c)

1 participant