Apache/PHP segmentation fault except when using Xdebug (Drupal)

When performing a specific action* in a Drupal 7 project, I get the following error in /var/log/apache2/error.log:

[Fri Jun 26 09:53:55.307644 2015] [core:notice] [pid 1553] AH00051: child pid 9998 exit signal Segmentation fault (11), possible coredump in /etc/apache2

Except that when using the step by step function of Xdebug, it doesn’t crash.
And when using xdebug.auto_trace=ON, it doesn’t crash either.

What could cause a segmentation fault in PHP, except when using Xdebug?

*: The error occurs when sending an email, but only when the recipient is the currently logged in user.

By putting log messages in the code, I’ve been able to determine that the crash occurs when autoloading the MailMIME class.

In includes/bootstrap.inc, in the _registry_check_code function, if I put the following code:

if($type == 'class' && $name == 'MailMIME')
    file_put_contents('/tmp/log.txt', "DEBUG 01n", FILE_APPEND);

before line 3147, which is:

$file = Database::getConnection('default', 'default')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array(
    ':name' => $name,
    ':type' => $type,

then, I can see “DEBUG 01” in my log file, and it crashes.

However, if I put the same code after the lines 3147 to 3151, it stops crashing…

EDIT: I am able to reproduce the bug on my Ubuntu 14.04 machine with PHP 5.5, but I can’t reproduce it on a Windows machine with PHP 5.6.

Source: apache

Leave a Reply