phplaravellaravel-sailphp-8.4

PHP 8.4 Upgrade in Laravel Sail Causes zend_mm_heap corrupted Error During PHPUnit Tests


Environment:

We are upgrading from PHP 8.2 to PHP 8.4. The only change made so far has been upgrading PHP within Laravel Sail and rebuilding the Docker image.

When checking the version, everything seems correct:

% sail php -v
PHP 8.4.1 (cli) (built: Nov 25 2024 18:04:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1, Copyright (c) Zend Technologies
with Zend OPcache v8.4.1, Copyright (c), by Zend Technologies
with Xdebug v3.4.0, Copyright (c) 2002-2024, by Derick Rethans

However, when running PHPUnit tests, we encounter the following error (after around 100 successful tests):

% sail test

zend_mm_heap corrupted

   Symfony\Component\Process\Exception\ProcessSignaledException 

  The process has been signaled with signal "6".

  at vendor/symfony/process/Process.php:462
    458▕             usleep(1000);
    459▕         }
    460▕ 
    461▕         if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  ➜ 462▕             throw new ProcessSignaledException($this);
    463▕         }
    464▕ 
    465▕         return $this->exitcode;
    466▕     }

      +15 vendor frames 

  16  artisan:13
      Illuminate\Foundation\Application::handleCommand()

Problem Details:

The error doesn’t seem tied to any specific test case and feels more like a memory issue, but I’m not entirely sure. The zend_mm_heap corrupted message suggests that something might be going wrong with PHP’s memory manager.

What I’ve Tried:

  1. Rebuilt the Laravel Sail Docker container.
  2. Verified PHP, Laravel, and PHPUnit versions are up-to-date.

Any guidance on how to debug or resolve this would be greatly appreciated.

Update (16/12/24)

I switched the unit tests to SQLite and ran them through Laravel Herd with the same results:


Solution

  • We experienced the same issue after upgrading to 8.4.

    We narrowed it down to the hisorange/browser-detect composer package. Are you using that? Try disabling it / commenting it out.