Doc #61284 [Opn->Csd]: Misleading example
| From: | krakjoe@php.net | Date: | Sat, 01 Feb 2014 10:10:10 +0000 |
| Subject: | Doc #61284 [Opn->Csd]: Misleading example | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10920@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61284&edit=1
ID: 61284
Updated by: krakjoe@php.net
Reported by: alvaro at demogracia dot com
Summary: Misleading example
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: 5.3.10
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
This has since been documented appropriately.
Thanks for taking the time to make PHP better :)
Previous Comments:
------------------------------------------------------------------------
[2012-03-05 09:40:06] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61284&edit=1