Skip to content

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

Closed

Description

@PurHur

Category

Regression: · php-src-strict · highlight HTML wire format

Problem

highlight_string / highlight_file / show_source still do not match Zend’s HTML. Zend wraps with <code><span…> and uses &nbsp; for spaces; this compiler emits a <pre><code style=…> shell, omits &nbsp;, and uses different span nesting.

Probed 2026-07-29 (8a0cba472 vs host Zend 8.2.32), VM + JIT:

Check on highlight_string("<?php echo 1;", true) Zend 8.2+ VM/JIT
contains &nbsp; yes no
contains <pre> no yes
matches /<code><span/ yes no

#24662 / #24524 / #24288 / #23733 closed green earlier, but master is still red on this wire format (show_source matches the same wrong shell).

php-src reference

PHP implementation target

  • ext/standard/ highlight path + any lib/VM/Builtin/*Highlight* / JIT call mirror — emit Zend wire (<code><span…>, &nbsp;, no outer <pre>); no new C runtime logic

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/hl.php <<'"'"'PHP'"'"'
<?php
$z = highlight_string("<?php echo 1;", true);
echo "nbsp=" . (strpos($z, "&nbsp;") !== false ? "1":"0") . "\n";
echo "pre=" . (strpos($z, "<pre>") !== false ? "1":"0") . "\n";
echo "code_span=" . (preg_match("/<code><span/", $z) ? "1":"0") . "\n";
PHP
php /tmp/hl.php; php bin/vm.php /tmp/hl.php; php bin/jit.php /tmp/hl.php'

Done when

  • VM + JIT highlight_string($code, true) match Zend on &nbsp; / no <pre> / /<code><span/
  • highlight_file + show_source same wire
  • Compliance .phpt guard under test/compliance/cases/ (or test/repro/)
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 29, 2026
  2. PurHur commented on Jul 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #25063, #25097, #23785)

    Hard stdlib cluster: highlight_string/file/show_source Zend HTML wire (#25063), next/prev/current on object HT (#25097), highlight Reflection names (#23785). Shipping sequential PRs; starting with #25063.

  3. PurHur commented on Jul 30, 2026

    @PurHur
    OwnerAuthor

    Investigating: default CompilerVersion::VERSION is 8.4.0-dev, so highlight emits PHP 8.3+ <pre><code> wire (#24874). Host Zend in the pinned image is 8.2.32 (<code><span> + &nbsp;).

    Under PHP_COMPILER_PROFILE=8.2, VM already matches the #25063 shape checks (nbsp=1, pre=0, code_span=1). Confirming whether the issue wants (a) default profile to follow reference Zend 8.2 wire, or (b) docs/repro to use PROFILE=8.2 — colliding with closed #24874 if we flip the default.

  4. PurHur commented on Jul 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #25128

    Verification: Zend/VM/JIT reference wire identical (nbsp=1 pre=0 code_span=1); PROFILE=8.4 modern wire still green; compliance extracts + VmHighlightTest 8/8.

    Batch next: #25097 (next/prev/current on object HT).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions