Skip to content

ionCube(?) causes bin/magento to segfault when run inside the debug container (PHP 8.1) #35

@mattijv

Description

@mattijv

Tested with

  • Warden 0.14.3
  • PHP 8.1.29 (seems to be the current default when initializing Warden environment)
  • Xdebug 3.3.2
  • ionCube Loader 13.3.1

Steps to reproduce

  1. Initialize a new Warden environment warden env-init, choose magento2 as the type.
  2. Install symfony/console with composer require symfony/console.
  3. Add the test file (below) and enter the debug container.
  4. Run php test.php.

This should result in the following:

www-data@segfault-php-debug:/var/www/html$ php test.php 
Segmentation fault (core dumped)

(Xdebug will complain about not being able to connect, but that does not affect the problem so I omitted it from the output.)

Test file to trigger the issue

<?php

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\CompleteCommand;

require 'vendor/autoload.php';

$attribute = (new \ReflectionClass(CompleteCommand::class))->getAttributes(AsCommand::class);

$attribute[0]->newInstance();

Details

I faced this problem when running the Magento CLI command (bin/magento) and tracked down the problematic lines to \Symfony\Component\Console\Command\Command::getDefaultName (when subclassed as \Symfony\Component\Console\Command\CompleteCommand). The test file is a minimal sample that triggers the issue.

Running the file with gdb reveals the following stack trace after triggering the segfault:

Program received signal SIGSEGV, Segmentation fault.
0x000055f832a87323 in zend_observer_fcall_end ()
(gdb) bt full
#0  0x000055f832a87323 in zend_observer_fcall_end ()
#1  0x000055f832a55519 in execute_ex ()
#2  0x00007fdb459e83f5 in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#3  0x00007fdb459e847b in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#4  0x00007fdb45a8ef0d in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#5  0x00007fdb45a9af70 in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#6  0x00007fdb459a61b3 in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#7  0x00007fdb4592c995 in xdebug_execute_internal () from /usr/lib64/php/modules/xdebug.so
#8  0x000055f832832df4 in ZEND_DO_FCALL_SPEC_OBSERVER_HANDLER ()
#9  0x000055f83283382a in execute_ex[cold] ()
#10 0x00007fdb459e83f5 in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#11 0x00007fdb459e847b in ?? () from /usr/lib64/php/modules/ioncube_loader.so
#12 0x000055f832a5f1d9 in zend_execute ()
#13 0x000055f8329ef250 in zend_execute_scripts ()
#14 0x000055f832989f1a in php_execute_script ()
#15 0x000055f832ad83fe in do_cli ()
#16 0x000055f83283ddeb in main ()

The segmentation fault does not happen if I either

  1. run the sample program from the normal (non-Xdebug) shell, OR
  2. disable the ionCube loaders by commenting out the line in /etc/php.d/01-ioncube-loader.ini.

Thoughts

I'm guessing this is an issue with ionCube and not in the Warden images per se. However, since the images bundle the problematic version, and I can't quickly find an official way to disable it, I'm opening this issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions