Doc #63781 [Opn->Csd]: Several discrepancies between PDO attribute behaviour and documentation
| From: | cmb@php.net | Date: | Thu, 05 Nov 2020 14:20:26 +0000 |
| Subject: | Doc #63781 [Opn->Csd]: Several discrepancies between PDO attribute behaviour and documentation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18093@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63781&edit=1
ID: 63781
Updated by: cmb@php.net
Reported by: tomas dot creemers+bugs dot php dot net at gmail dot
com
Summary: Several discrepancies between PDO attribute
behaviour and documentation
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: PDO related
Operating System: Windows
PHP Version: 5.3.19
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
MYSQL_ATTR_CIPHER and MYSQL_ATTR_KEY have already been fixed[1].
Regarding the "wrong" types: the manual documents the type of the
constant, but not the type of its value, and all of these
constants have integer values.
Regarding the unavailable attributes: these are attributes of
statements, not of the database connection.
[1] <http://svn.php.net/viewvc?view=revision&revision=329486>
Previous Comments:
------------------------------------------------------------------------
[2012-12-15 23:37:07] tomas dot creemers+bugs dot php dot net at gmail dot com
Description:
------------
I have done some checking regarding the availability of PDO attributes and their value type and how
these things are documented.
The documentation for some attributes notes that the attribute in question is not always present. A
user might assume that any attribute that doesn't carry such a note will always be present.
This is not the case, which is confusing. Best would be to carefully document which attributes are
always present (PDO core) and which are not. If this is not feasible, a warning at the top of the
page saying that there is no guarantee for any attribute to exist can alert users to the problem.
The type of all attribute's values is always documented, but often wrong.
I have included the output of a script I've written to check the PDO constants
(http://php.net/manual/en/pdo.constants.php) and PDO_Mysql constants
(http://php.net/manual/en/ref.pdo-mysql.php#pdo-mysql.constants) in the "actual result"
section.
PHP Version => 5.3.19
PDO support => enabled
PDO drivers => mysql
PDO Driver for MySQL => enabled
mysqlnd => enabled
Version => mysqlnd 5.0.8-dev - 20102224 - $Id: 65fe78e70ce53d27a6cd578597722950e490b0d0 $
Compression => supported
SSL => supported
I believe problems #1, #2, #19 and #23 are indicating the documentation missed the "SSL_"
part in the constant name. I.e. the documentation talks about PDO::MYSQL_ATTR_CIPHER but the
constant is PDO::MYSQL_ATTR_SSL_CIPHER.
Test script:
---------------
http://pastebin.com/wYF1hmfN
Actual result:
--------------
#1 MYSQL_ATTR_CIPHER is in the documentation but not defined as a class constant.
#2 MYSQL_ATTR_KEY is in the documentation but not defined as a class constant.
#3 ATTR_TIMEOUT could not be retrieved but the documentation makes it appear it is always present.
#4 ATTR_SERVER_VERSION has type string but is documented as integer.
#5 ATTR_CLIENT_VERSION has type string but is documented as integer.
#6 ATTR_SERVER_INFO has type string but is documented as integer.
#7 ATTR_CONNECTION_STATUS has type string but is documented as integer.
#8 ATTR_CURSOR_NAME could not be retrieved but the documentation makes it appear it is always
present.
#9 ATTR_CURSOR could not be retrieved but the documentation makes it appear it is always present.
#10 ATTR_PERSISTENT has type boolean but is documented as integer.
#11 ATTR_STATEMENT_CLASS has type array but is documented as integer.
#12 ATTR_STRINGIFY_FETCHES could not be retrieved but the documentation makes it appear it is always
present.
#13 ATTR_MAX_COLUMN_LEN could not be retrieved but the documentation makes it appear it is always
present.
#14 ATTR_EMULATE_PREPARES could not be retrieved but the documentation makes it appear it is always
present.
#15 MYSQL_ATTR_LOCAL_INFILE could not be retrieved but the documentation makes it appear it is
always present.
#16 MYSQL_ATTR_INIT_COMMAND could not be retrieved but the documentation makes it appear it is
always present.
#17 MYSQL_ATTR_FOUND_ROWS could not be retrieved but the documentation makes it appear it is always
present.
#18 MYSQL_ATTR_IGNORE_SPACE could not be retrieved but the documentation makes it appear it is
always present.
#19 MYSQL_ATTR_SSL_KEY is defined as a class constant but is not in the documentation.
#20 MYSQL_ATTR_SSL_CERT could not be retrieved but the documentation makes it appear it is always
present.
#21 MYSQL_ATTR_SSL_CA could not be retrieved but the documentation makes it appear it is always
present.
#22 MYSQL_ATTR_SSL_CAPATH could not be retrieved but the documentation makes it appear it is always
present.
#23 MYSQL_ATTR_SSL_CIPHER is defined as a class constant but is not in the documentation.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63781&edit=1