Skip to content

[Bug]: Herd 1.24.2 + PHP 8.3.29 outputs literal "8"-->" in WordPress HTML #1610

@BartoszMacek

Description

@BartoszMacek

Platform

macOS

Operating system version

macOS: Tahoe 26.1

System architecture

Apple M3, Apple Silicon

Herd Version

1.24.2 (Build 59)

PHP Version

PHP 8.3.29

Bug description

Environment

  • Herd version: 1.24.2 (latest)
  • PHP versions tested: 8.2, 8.3.29, 8.5 (bug occurs on all)
  • OS: macOS
  • CMS: WordPress 6.9 (multiple sites affected)

Issue
Herd 1.24.2 injects a literal string 8"--> multiple times in HTML output between closing tags (</style>, </script>) and subsequent opening tags (<link>, <script>).
Reproduction Steps

Install Herd 1.24.2

  1. Create any WordPress site (tested on WP 6.9, 6.8, and older versions)
  2. View page source (View → Developer → View Source)
  3. Search for 8"-->
  4. Observe multiple occurrences of this literal string in the HTML

Expected Behavior
Clean HTML output without any injected strings.

Actual Behavior
Literal 8"--> appears between tags:

</style>
8"--><link rel="stylesheet" href="...">
</script>
8"--><script src="...">

Technical Details

  • HEX representation: 38222d2d3e (confirms it's literal UTF-8 text, not encoding corruption)
  • Pattern: Always appears after closing </style> or </script> tags
  • Frequency: 3-6 occurrences per page load (multiplies when logged into WordPress admin)

Debug Information

Nginx config check:

cat ~/Library/Application\ Support/Herd/config/nginx/nginx.conf | grep gzip
# gzip disabled, still occurs

PHP settings:

herd php -i | grep output_buffering
# output_buffering => 0 => 0

Confirmed Working Version

Herd 1.23: Does NOT have this issue (confirmed on colleague's machine)

Workaround

// wp-content/mu-plugins/fix-herd-bug.php
add_action('init', function() {
    ob_start(function($buffer) {
        return str_replace('8"-->', '', $buffer);
    });
}, 1);

Impact

  • Visible in page source
  • Breaks HTML validation
  • Affects all WordPress sites on Herd 1.24.2
  • Does not occur on production servers or other local environments

Additional Context
Issue was initially suspected to be:

  • WordPress 6.9 bug (ruled out - occurs on WP 6.8 and older)
  • PHP version issue (ruled out - occurs on PHP 8.2, 8.3, 8.5)
  • Nginx gzip compression (ruled out - disabled, still occurs)
  • Output buffering (ruled out - confirmed disabled)

This appears to be a regression introduced between Herd 1.23 and 1.24.2.

Steps to reproduce

  1. Fresh WordPress installation on Herd 1.24.2
  2. View page source
  3. Search for '8"-->'

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions