php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63781 Several discrepancies between PDO attribute behaviour and documentation
Submitted: 2012-12-15 23:37 UTC Modified: 2020-11-05 14:20 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: tomas dot creemers+bugs dot php dot net at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PDO related
PHP Version: 5.3.19 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 18 = ?
Subscribe to this entry?

 
 [2012-12-15 23:37 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-05 14:20 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-11-05 14:20 UTC] cmb@php.net
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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC