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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tgross at m-s dot de
New email:
PHP Version: OS:

 

 [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-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 12:03:13 2021 UTC