php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61284 Misleading example
Submitted: 2012-03-05 09:40 UTC Modified: 2014-02-01 10:10 UTC
From: alvaro at demogracia dot com Assigned: krakjoe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.10 OS:
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: alvaro at demogracia dot com
New email:
PHP Version: OS:

 

 [2012-03-05 09:40 UTC] alvaro at demogracia dot com
Description:
------------
---
From manual page: http://www.php.net/pdo.error-handling
---

The example provided ("Create a PDO instance and set the error mode") is correct 
but IMHO it's slightly misleading as well. It suggests that this line:

$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

... has any effect in capturing connection errors but, if connection fails, the 
line will not even execute.

The base problem is probably that the PDO constructor does not seem to obey 
PDO::ATTR_ERRMODE settings anyway: on error, it'll always trigger a warning and 
throw a PDOException. That's not documented either.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-01 10:10 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-02-01 10:10 UTC] krakjoe@php.net
This has since been documented appropriately.

Thanks for taking the time to make PHP better :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 02:01:28 2024 UTC