php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71844 Segfault with Symfony3
Submitted: 2016-03-17 13:26 UTC Modified: 2016-09-25 04:22 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:-3 (-100.0%)
From: guillaume dot bretou at sidexa dot fr Assigned:
Status: No Feedback Package: PDO DBlib
PHP Version: 7.0.4 OS: CentOS 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: guillaume dot bretou at sidexa dot fr
New email:
PHP Version: OS:

 

 [2016-03-17 13:26 UTC] guillaume dot bretou at sidexa dot fr
Description:
------------
Hello,

I have got a problem running PHP7 with SF3/SQL Server 2008

Env : 
 - OS : CentOS7
 - PHP : PHP 7.0.4

List of modules : 
[vagrant@localhost api]$ php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
libxml
mbstring
mcrypt
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache


Steps to reproduce : 
 - configure FreeTDS : 
        [dev_fr]
                host = HOST
                port = 1433
                tds version = 8.0

once the SF3 application is generated, I created the following entity: 

==============
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Company
 *
 * @ORM\Table(name="company")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\CompanyRepository")
 */
class Company
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * @ORM\OneToMany(targetEntity="Customer", mappedBy="company")
     */
    private $customers;

    /**
     * Company constructor.
     */
    public function __construct()
    {
        $this->customers = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return Company
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}
======================================

 - configure parameters and config:
doctrine:
    dbal:
        driver_class:   Realestate\MssqlBundle\Driver\PDODblib\Driver
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"

 - checked that connection was OK with simple Select statement
 - Then I tried creating some entity with DoctrineFixturesBundle: 

/**
 * Created by PhpStorm.
 * User: gbu
 * Date: 16/03/2016
 * Time: 15:57
 */

namespace AppBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use AppBundle\Entity\Company;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadCompanyData implements FixtureInterface, ContainerAwareInterface
{
    /**
     * @var array
     */
    protected $data = [
        [
            'name' => 'TESTED'
        ],
    ];

    /**
     * @var ContainerInterface
     */
    private $container;

    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    /**
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager)
    {
        $em = $this->container->get('doctrine')->getManager();

        foreach ($this->data as $companyData) {
            $company = new Company();
            $company->setName($companyData['name']);
            $em->persist($company);
            $em->flush();
        }
    }
}

 - Output of the command : 
[vagrant@localhost api]$ php bin/console doctrine:fixtures:load
Careful, database will be purged. Do you want to continue y/N ?y
  > purging database
  > loading AppBundle\DataFixtures\ORM\LoadCompanyData
Segmentation fault

 - I tried to run this xdebug to gather some more information:
 php -d xdebug.auto_trace=ON -d xdebug.collect_params=4 -d xdebug.trace_output_dir=/tmp bin/console doctrine:fixtures:load

Here are the last lines in the trace file : 
5.2060   11850064                                       -> Symfony\Component\Debug\ErrorHandler::stackErrors() /var/www/html/src/api/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:118
    5.2060   11850064                                         -> error_reporting() /var/www/html/src/api/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:619
    5.2060   11850064                                         -> error_reporting(32767) /var/www/html/src/api/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:619
    5.2060   11850064                                       -> Composer\Autoload\ClassLoader->findFile($class = 'Doctrine\\ORM\\Event\\LifecycleEventArgs') /var/www/html/src/api/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:122
    5.2060   11850064                                         -> Composer\Autoload\ClassLoader->findFileWithExtension($class = 'Doctrine\\ORM\\Event\\LifecycleEventArgs', $ext = '.php') /var/www/html/src/api/vendor/composer/ClassLoader.php:329
    5.2060   11850064                                           -> strtr('Doctrine\\ORM\\Event\\LifecycleEventArgs', '\\', '/') /var/www/html/src/api/vendor/composer/ClassLoader.php:347
    5.2060   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Instantiator\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2060   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\DBAL\\Migrations\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2060   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Common\\Cache\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2060   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Common\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2060   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Bundle\\MigrationsBundle\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2061   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Bundle\\FixturesBundle\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2061   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Bundle\\DoctrineCacheBundle\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2061   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\Bundle\\DoctrineBundle\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2061   11850176                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'DeepCopy\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:352
    5.2061   11850272                                           -> file_exists('/var/www/html/src/api/src/Doctrine/ORM/Event/LifecycleEventArgs.php') /var/www/html/src/api/vendor/composer/ClassLoader.php:364
    5.2064   11850272                                           -> strrpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', '\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:370
    5.2064   11850272                                           -> substr('Doctrine/ORM/Event/LifecycleEventArgs.php', 0, 19) /var/www/html/src/api/vendor/composer/ClassLoader.php:372
    5.2064   11850320                                           -> substr('Doctrine/ORM/Event/LifecycleEventArgs.php', 19) /var/www/html/src/api/vendor/composer/ClassLoader.php:373
    5.2064   11850368                                           -> strtr('LifecycleEventArgs.php', '_', '/') /var/www/html/src/api/vendor/composer/ClassLoader.php:373
    5.2064   11850352                                           -> strpos('Doctrine\\ORM\\Event\\LifecycleEventArgs', 'Doctrine\\ORM\\') /var/www/html/src/api/vendor/composer/ClassLoader.php:381
    5.2064   11850368                                           -> file_exists('/var/www/html/src/api/vendor/doctrine/orm/lib/Doctrine/ORM/Event/LifecycleEventArgs.php') /var/www/html/src/api/vendor/composer/ClassLoader.php:383

Please, feel free to ask further information,

Thank you,

 








Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-17 14:21 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-03-17 14:21 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2016-03-23 16:47 UTC] guillaume dot bretou at sidexa dot fr
Hello,

I have tried to compile PHP 7.0.4 with the debug mode but now I don't get the segfault anymore.
As I'm not very confortable with PHP compilation, here are the option list I used.

./configure     --with-libdir=lib64     --prefix=/home/vagrant/php     --with-layout=PHP     --with-pear     --enable-calendar     --enable-bcmath     --enable-exif     --enable-debug --with-zlib --enable-ftp --enable-debug --enable-opcache --enable-fpm --with-curl --with-pdo-dblib

The other PHP 7 I use was installed using a package manager (using this http://blog.remirepo.net/post/2016/02/14/Install-PHP-7-on-CentOS-RHEL-Fedora)
Here is the trace I could get with this PHP 7.0.4.

(gdb) bt
#0  0x00007f3c2d748f31 in _emalloc_8 ()
#1  0x00007f3c2d79b7f5 in tsrm_realpath ()
#2  0x00007f3c2d712cb0 in php_resolve_path ()
#3  0x00007f3c1912397d in phar_find_in_include_path () from /opt/remi/php70/root/usr/lib64/php/modules/phar.so
#4  0x00007f3c2d7f14f4 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER ()
#5  0x00007f3c2d7ab1eb in execute_ex ()
#6  0x00007f3c2d75d449 in dtrace_execute_ex ()
#7  0x00007f3c2d75ee4c in zend_call_function ()
#8  0x00007f3c2d78a2d3 in zend_call_method ()
#9  0x00007f3c2d6747b4 in zif_spl_autoload_call ()
#10 0x00007f3c2d75d56b in dtrace_execute_internal ()


Can it be helpful ?
 [2016-03-23 16:48 UTC] guillaume dot bretou at sidexa dot fr
-Status: Feedback +Status: Open
 [2016-03-23 16:48 UTC] guillaume dot bretou at sidexa dot fr
Update status
 [2016-09-14 22:01 UTC] adambaratz@php.net
-Status: Open +Status: Feedback
 [2016-09-14 22:01 UTC] adambaratz@php.net
Could you retest with the latest version of PHP? If the issue is still there, some more specifics would be helpful. It's not necessarily clear from your details that pdo_dblib is involved. It's not part of the backtrace you provided.
 [2016-09-25 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC