#37294 [Opn->Asn]: PHP crashes Apache on PDO::query instead of throwing an exception

From: Date: Wed, 03 May 2006 15:38:34 +0000
Subject: #37294 [Opn->Asn]: PHP crashes Apache on PDO::query instead of throwing an exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96556@lists.php.net to get a copy of this message
ID: 37294 Updated by: tony2001@php.net Reported By: tgross at m-s dot de -Status: Open +Status: Assigned Bug Type: PDO related Operating System: Windows 2000 PHP Version: 5.1.3 -Assigned To: +Assigned To: wez Previous Comments: ------------------------------------------------------------------------ [2006-05-03 14:58:41] tgross at m-s dot de Description: ------------ When calling PDO::query(), PHP crashes Apache on certain queries if the SQL-query contains errors. In the example, Query 1 is correct. Query 2 is wrong, and the exception is thrown (which is expected). Query 3 causes Apache to crash. Reproduce code: --------------- $dbh = new PDO ('odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:/path/to/database/db.mdb', '', ''); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); try { //$result = $dbh->query('select * from aktuelles'); // Query 1: Correct //$result = $dbh->query('select * from aktuellesX'); // Query 2: Wrong (Table aktuellesX does not exist) $result = $dbh->query('selectX * from aktuelles'); // Query 3: Wrong (Command selectX does not exist) $ret = $result->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { echo "Failed: " , $e->getMessage(); } Expected result: ---------------- PHP throws an exception and displays the error message. Actual result: -------------- Apache crashes. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37294&edit=1

« previous php.bugs (#96556) next »