Bug #71916 [Opn->Ver]: Two attribute constants use the same value
| From: | krakjoe@php.net | Date: | Tue, 29 Mar 2016 12:18:20 +0000 |
| Subject: | Bug #71916 [Opn->Ver]: Two attribute constants use the same value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200209@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71916&edit=1
ID: 71916
Updated by: krakjoe@php.net
Reported by: downsider84 at hotmail dot com
Summary: Two attribute constants use the same value
-Status: Open
+Status: Verified
Type: Bug
Package: PDO Core
Operating System: Irrelevant
PHP Version: 7.0.4
Block user comment: N
Private report: N
New Comment:
This seems to be a flaw in the design of PDO; Drivers with driver specific attributes are instructed
to use the same value "PDO_ATTR_DRIVER_SPECIFIC" (1000) to identify their first specific
attribute.
Any two drivers with driver specific attributes are vulnerable to the same problem.
I am not super familiar with PDO, so, unsure how to fix it ...
Previous Comments:
------------------------------------------------------------------------
[2016-03-29 11:34:01] downsider84 at hotmail dot com
Description:
------------
The constants MYSQL_ATTR_USE_BUFFERED_QUERY and PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT have
the same value, 1000.
Setting MYSQL_ATTR_USE_BUFFERED_QUERY when using the pgsql driver causes a "deprecated"
warning about PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT. This is non-obvious and potentially
difficult to debug.
Test script:
---------------
ini_set("display_errors", 1);
error_reporting(E_ALL);
// change credentials as appropriate
$dbName = "test";
$host = "locahost";
$username = "root";
$password = "";
$pdo = new \PDO("pgsql:$dbName=db;host=$host", $username, $password);
$pdo->setAttribute(\PDO:MYSQL_ATTR_USE_BUFFERED_QUERY, true);
Expected result:
----------------
Deprecated: PDO::setAttribute(): PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated,
use PDO::ATTR_EMULATE_PREPARES instead in [filename] on line [lineno]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71916&edit=1