php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62798 Parameter change in MySQL not reflected in MySQLi
Submitted: 2012-08-11 15:42 UTC Modified: 2014-02-25 23:30 UTC
From: Danack at basereality dot com Assigned: philip (profile)
Status: Closed Package: MySQLi related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Danack at basereality dot com
New email:
PHP Version: OS:

 

 [2012-08-11 15:42 UTC] Danack at basereality dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli-stmt.attr-set#refsect1-mysqli-
stmt.attr-set-parameters
---

The current documentation says that "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH - If set 
to 1, causes mysqli_stmt_store_result() to update the metadata MYSQL_FIELD-
>max_length value."

This is a mis-feature caused by the MySQL documentation being incorrect. The 
field was described as a boolean but was actually being used as a long. This has 
been fixed in MySQL.

http://bugs.mysql.com/bug.php?id=16144

It also appears to be fixed in MySQLi (lots of code surrounded by 
MYSQL_VERSION_ID >= 50107) however:

1) The documentation has not been updated.
2) Setting any value other than 1 appears to have no effect.


I've raised this as a documentation problem as from my reading of the MySQLi 
code I think the parameter MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH should be setting 
the maximum field length returned by MySQLi, however that functionality also 
appears not to be working, so will retest once the documentation reflects the 
current code.



Test script:
---------------
Details of how to reproduce are here:

http://stackoverflow.com/questions/11913818/php-massive-memory-usage-for-sql-query

I can provide a standalone script if required, but as this is a documentation problem first, I haven't yet.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-06 01:42 UTC] will dot skates at ntlworld dot com
https://edit.php.net/?project=PHP&perm=en/mysqli-stmt.attr-set.php
 [2013-03-13 13:40 UTC] uw@php.net
Hi,

I am not sure whether we need to change the mysqli documentation. The detail makes no difference to the user. Passing 1 oder bool true makes no difference, its casted to boolean internally, if need be. And, from a PHP user perspective there is only one thing you can do: turn on, turn off. 

libmysql not reacting properly to the setting used to be a known bug that is not present in mysqlnd. There are no memory issues if using mysqlnd. Thus, use mysqlnd, which is the compile time default since 5.4 anyway.

Libmysql bugs should be reported at bugs.mysql.com. The php.net bug system is no good place for it.
 [2014-02-25 23:29 UTC] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&revision=332890
Log: PHP Bug #62798 - MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH update and see also
 [2014-02-25 23:30 UTC] philip@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: philip
 [2014-02-25 23:30 UTC] philip@php.net
This is fixed in SVN, thank you for the bug report! And for good measure, we also link to Connector/MYSQL mysql_stmt_attr_set().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 22:01:31 2024 UTC