Edit report at https://bugs.php.net/bug.php?id=60837&edit=1
ID: 60837 Updated by: g...@php.net Reported by: piphon at gmail dot com Summary: Segmentation fail, if use trait Status: Critical Type: Bug Package: Reproducible crash Operating System: Ubuntu 11.10 64bit PHP Version: 5.4SVN-2012-01-22 (SVN) Block user comment: N Private report: N New Comment: Hi, I was not able to reproduce the problem, because I do not have the necessary setup. Think, I got as far as that PDO complains about a missing database table, but I also changed the db driver from mysql to sqlite. The only thing I saw was that on an old checkout, the bug with doccomments #60809 caused segfaults. But, that seems unrelated to the stacktrace below. Previous Comments: ------------------------------------------------------------------------ [2012-01-23 07:40:43] piphon at gmail dot com Check last commits for RC in SVN: PHP 5.4.0 RC5 - fail (https://svn.php.net/repository/php/php-src/tags/php_5_4_0RC5) PHP 5.4.0 RC6 - fail (https://svn.php.net/repository/php/php-src/tags/php_5_4_0RC6) PHP 5.4.0 RC7-dev - worked in last commits (https://svn.php.net/repository/php/php-src/branches/PHP_5_4) I'm unable to verify trunk (PHP 5.5 dev), because PDO is not installed or is not compiled. P.S. My English bad... ------------------------------------------------------------------------ [2012-01-23 03:24:56] larue...@php.net I can not reproduce this... everything works well here.. (both svn-trunk and 5.4 branch) ------------------------------------------------------------------------ [2012-01-22 12:30:40] piphon at gmail dot com > Do you have a reproduce code by any chance? Yes. Finally recreated it. Small example with dependencies (zf, doctrine, e.t.c) on github.com: g...@github.com:alurin/zend-bug.git Files: - Example/IdentityTrait.php - trait, add id field - Example/Temp.php - entity, used IdentityTrait - library/ - vendors libraries (submodules) - bootstrap.php - setup doctrine - script.php - Console interface for doctrine (if update or create data scheme). - index.php - Test example $ php script.php orm:schema-tool:create ATTENTION: This operation should not be executed in a production environment. Creating database schema... Database schema created successfully! Segmentation fail (core dumped) $ php index.php zend_mm_heap corrupted All code in two files index.php --------- <?php use Doctrine\ORM\EntityManager, Doctrine\ORM\Configuration; define('PATH_TO_VENDORS', realpath(__DIR__ . '/library')); // ÐодклÑÑение авÑозагÑÑзки клаÑÑов библоÑек require_once PATH_TO_VENDORS . '/zf2/library/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory( array( 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( 'Zend' => PATH_TO_VENDORS . '/zf2/library/Zend', 'Doctrine\ORM' => PATH_TO_VENDORS . '/doctrine2/lib/Doctrine/ORM', 'Doctrine\Common' => PATH_TO_VENDORS . '/doctrine2-common/lib/Doctrine/Common', 'Doctrine\DBAL' => PATH_TO_VENDORS . '/doctrine2-dbal/lib/Doctrine/DBAL', 'Symfony\Component\Console' => PATH_TO_VENDORS . '/symfony-console', 'Symfony\Component\Yaml' => PATH_TO_VENDORS . '/symfony-yaml', ) ) ) ); function create_doctrine() { $cache = new \Doctrine\Common\Cache\ArrayCache; $config = new Configuration; $config->setMetadataCacheImpl($cache); $driverImpl = $config->newDefaultAnnotationDriver(__DIR__ . '/Example'); $config->setMetadataDriverImpl($driverImpl); $config->setQueryCacheImpl($cache); $config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies'); $config->setProxyNamespace('MyProject\Proxies'); $config->setAutoGenerateProxyClasses(false); $connectionOptions = array( 'driver' => 'pdo_mysql', /* Your DB driver here */ 'host' => 'localhost', /* Your DB host here */ 'user' => 'php_bug', /* Your DB user here */ 'password' => 'A8haaWUH7wxjhfrn', /* Your DB user password */ 'dbname' => 'php_bug', /* Your DB name here */ 'driverOptions' => array( 1002 => "SET NAMES 'UTF8'" ), ); $em = EntityManager::create($connectionOptions, $config); return $em; } $main = function() { $em = create_doctrine(); include 'full-compounds.php'; $temp = new Example\Temp(); $em->persist($temp); $em->flush(); $repo = $em->getRepository('Example\Temp'); $temp = $repo->find(1); $temp->events()->attach('init', function() { echo "Init\n"; }); }; call_user_func_array($main, array()); full-compunds.php ----------------- <?php namespace Example; use Zend\EventManager\ProvidesEvents; trait EntityTrait { } trait IdentityTrait { use EntityTrait; /** * УникалÑнÑй иденÑиÑикаÑÐ¾Ñ Ð¾Ð±ÑекÑа в ÐÐ * * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") * @since 0.1 * @var int */ private $id = null; /** * ÐолÑÑиÑÑ ÑникалÑнÑй иденÑиÑикаÑÐ¾Ñ Ð¾Ð±ÑекÑа в ÐÐ * * @return int * @since 0.1 */ public function getID() { return $this->id; } } /** * ÐÐ¾Ð´ÐµÐ»Ñ Ð¾Ð¿Ð¸ÑÑваÑÑÐ°Ñ ÑÑаÑиÑеÑкÑÑ ÑÑÑаниÑÑ ÑайÑа * * @Entity */ class Temp { use IdentityTrait; use ProvidesEvents; } ------------------------------------------------------------------------ [2012-01-22 11:40:40] g...@php.net zend_opcode.c:295 is zend_hash_destroy(&ce->function_table); I don't see why the function table would be problematic, but I will try to look into it today. ------------------------------------------------------------------------ [2012-01-22 09:57:41] paj...@php.net Do you have a reproduce code by any chance? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=60837 -- Edit this bug report at https://bugs.php.net/bug.php?id=60837&edit=1