From:             tgross at m-s dot de
Operating system: Windows 2000
PHP version:      5.1.3
PHP Bug Type:     PDO related
Bug description:  PHP crashes Apache on PDO::query instead of throwing an 
exception

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 bug report at http://bugs.php.net/?id=37294&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37294&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37294&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37294&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37294&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37294&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37294&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37294&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37294&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37294&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37294&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37294&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37294&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37294&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37294&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37294&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37294&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37294&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37294&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37294&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37294&r=mysqlcfg

Reply via email to