[php-src] Issue #21029: [ARM64] zend_mm_heap corrupted with ZTS builds (Static PHP 8.5.2)

From: Date: Sat, 24 Jan 2026 21:24:44 +0000
Subject: [php-src] Issue #21029: [ARM64] zend_mm_heap corrupted with ZTS builds (Static PHP 8.5.2)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251596@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21029 Author: 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: ```bash # 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: ```bash 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 ```plain 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

« previous php.bugs (#251596) next »