Skip to content

[ARM64] zend_mm_heap corrupted with ZTS builds (Static PHP 8.5.2) #21029

@maks-oleksyuk

Description

@maks-oleksyuk

Description

On ARM64 (aarch64) architecture, ZTS builds of PHP 8.5.2 cause zend_mm_heap corrupted errors when running Laravel Pint. The same code works fine on x86_64.

Cross-platform comparison:

Architecture Build Result
x86_64 Static PHP 8.5.2 ZTS ✅ Works
aarch64 Static PHP 8.5.2 ZTS ❌ Crashes with zend_mm_heap corrupted

Key details:

  • Built with: zig 0.15.2
  • ZTS (Zend Thread Safety): enabled
  • Architecture: aarch64 (ARM64 - Apple Silicon M4)

Minimal Reproduction Case

Laravel Pint can be used as a reliable reproduction case:

# Install Pint
composer require laravel/pint

# Run version command - this crashes on ARM64 ZTS
php vendor/bin/pint --version

Expected output:

Pint 1.27.0

Actual output on ARM64 ZTS:

zend_mm_heap corrupted
bash: line 1:  2005 Aborted                 ( php vendor/bin/pint --version )
exit status 134

Workaround

Setting USE_ZEND_ALLOC=0 environment variable fixes the issue:

USE_ZEND_ALLOC=0 php vendor/bin/pint --version
# Output: Pint 1.27.0

This forces PHP to use system memory allocator (malloc) instead of Zend Memory Manager.

PHP Configuration

memory_limit => 1024M
Zend Memory Manager => enabled
ZTS => yes
JIT => Disabled

The same PHP version (8.5.2 ZTS) works fine on x86_64 but fails on aarch64

PHP Version

PHP 8.5.2 (cli) (built: Jan 16 2026 02:41:43) (ZTS zig 0.15.2 aarch64)
Copyright (c) The PHP Group
Built by Static PHP <https://static-php.dev> #StandWithUkraine
Zend Engine v4.5.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.2, Copyright (c), by Zend Technologies

Operating System

MacOS Tahoe 26.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions