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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Fri May 17 05:01:31 2024 UTC