Edit report at https://bugs.php.net/bug.php?id=60715&edit=1
ID: 60715
User updated by: martin at martins-creations dot co dot uk
Reported by: martin at martins-creations dot co dot uk
Summary: Segfault
Status: Open
Type: Bug
-Package: MySQL related
+Package: Reproducible crash
Operating System: Debian
PHP Version: 5.4.0RC5
Block user comment: N
Private report: N
New Comment:
Incorrectly diagnosed as a MySQL fault with no comment, so I changed it back.
Previous Comments:
------------------------------------------------------------------------
[2012-01-11 16:04:46] martin at martins-creations dot co dot uk
I meant I had to compile pdo-mysql as shared
./configure --with-pdo-mysql=shared --enable-fpm --enable-inline-optimization
------------------------------------------------------------------------
[2012-01-11 15:44:14] martin at martins-creations dot co dot uk
Description:
------------
I can fix this segfault by either removing the ATTR_PERSISTENT option, or by
assigning parent::prepare to a local variable (i.e. $stmt =
parent::prepare('...'))
Also worth nothing I had to compile PHP as shared due to a bug when trying to
compile the extension with mysqlnd which is filed in a separate report.
Linux localdev 3.1.0-1-amd64 #1 SMP Fri Dec 23 16:37:11 UTC 2011 x86_64
GNU/Linux
$ php -v
PHP 5.4.0RC5 (cli) (built: Jan 10 2012 19:42:22)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
$ phpize -v
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
$ cat /etc/issue
Debian GNU/Linux wheezy/sid \n \l
$ mysql --version
mysql Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline
6.2
Test script:
---------------
<?php
class BuggedPDO extends PDO {
protected $stmt = null;
public function __construct() {
$options = array(
\PDO::ATTR_PERSISTENT => true,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
);
try {
parent::__construct('mysql:dbname=testdb;host=localhost', 'testuser',
'testpass', $options);
$this->stmt = parent::prepare('select * from table');
} catch (\Exception $ex) {
var_dump($ex);
}
}
}
$test = new BuggedPDO();
Expected result:
----------------
A proper resource in $this->stmt
Actual result:
--------------
Jan 11 10:26:00 kernel: [ 956.330577] php-fpm[2255]: segfault at 0 ip
0000000000729beb sp 00007fffad56c8e0 error 4 in php-fpm[400000+76d000]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60715&edit=1