#40639 [NEW]: DBLIB driver segfaults on repeated prepared select statements
| From: | spheroid@php.net | Date: | Mon, 26 Feb 2007 12:52:12 +0000 |
| Subject: | #40639 [NEW]: DBLIB driver segfaults on repeated prepared select statements | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-109538@lists.php.net to get a copy of this message | ||
From: spheroid@php.net
Operating system: Mac OS X 10.4.8
PHP version: 5CVS-2007-02-26 (CVS)
PHP Bug Type: PDO related
Bug description: DBLIB driver segfaults on repeated prepared select statements
Description:
------------
The DBLIB PDO driver seems to crash when first execution of
repeated prepared statement wont actually return any rows. If
the first execution does return rows, it works fine.
Reproduce code:
---------------
$pdo = new PDO('dblib:host=hostname;dbname=dbname', 'user', 'pass');
$query = "SELECT 'foo' WHERE '1' = :value";
$stmt = $pdo->prepare($query);
$values = array('0', '1');
foreach ($values as $value) {
$stmt->bindValue(':value', $value);
$stmt->execute();
while ($stmt->fetch() !== false);
$stmt->closeCursor();
}
Expected result:
----------------
Nothing.
Actual result:
--------------
(gdb) run dblib2.php
Starting program: /usr/local/bin/php dblib2.php
Reading symbols for shared libraries .+++..+++++..++++.. done
Program received signal EXC_BAD_ACCESS, Could not access
memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x000faf43 in do_fetch (stmt=0x172a624, do_bind=0,
return_value=0x172a944, how=PDO_FETCH_USE_DEFAULT,
ori=PDO_FETCH_ORI_NEXT, offset=0, return_all=0x0) at /usr/
local/src/PHP_5_2/ext/pdo/pdo_stmt.c:1026
1026 add_assoc_zval
(return_value, stmt->columns[i].name, val);
--
Edit bug report at http://bugs.php.net/?id=40639&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40639&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40639&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40639&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40639&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40639&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40639&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40639&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40639&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40639&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40639&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40639&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40639&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40639&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40639&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40639&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40639&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40639&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40639&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40639&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40639&r=mysqlcfg