php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37294 PHP crashes Apache on PDO::query instead of throwing an exception
Submitted: 2006-05-03 14:58 UTC Modified: 2006-05-08 16:38 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: tgross at m-s dot de Assigned: wez (profile)
Status: Closed Package: PDO related
PHP Version: 5.1.3 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 - 27 = ?
Subscribe to this entry?

 
 [2006-05-03 14:58 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-04 02:12 UTC] thad at bronto dot com
I see this exact behavior using apache 2.0.55 on Centos 
4.2 with php 5.1.3.
 [2006-05-08 16:38 UTC] tgross at m-s dot de
This is fixed in 5.1.4
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC