Bug #52234 mysql tries to allocate 4294967296 bytes when fetching longtext via php-mysqli
| Submitted: | 19 Mar 2010 20:28 | Modified: | 25 Mar 2010 7:09 |
|---|---|---|---|
| Reporter: | Moritz Schönauer | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
| Version: | 5.1.44 | OS: | Linux (gentoo) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | allocate, longtext, mysqli, php, prepared | ||
[19 Mar 2010 20:28]
Moritz Schönauer
[22 Mar 2010 7:58]
Sveta Smirnova
Thank you for the report. Please provide output of SHOW CREATE TABLE news and SELECT length(BLOB_FIELD) from news.
[23 Mar 2010 10:43]
Moritz Schönauer
SHOW CREATE TABLE news CREATE TABLE `news` ( `n_id` int(13) NOT NULL AUTO_INCREMENT, `n_title` varchar(50) NOT NULL, `n_note` longtext NOT NULL, `n_time` varchar(107) NOT NULL, `n_author` int(13) NOT NULL, PRIMARY KEY (`n_id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 SELECT length(n_note) from news 5
[23 Mar 2010 13:48]
Sveta Smirnova
Thank you for the feedback. I can not repeat described behavior. Please also provide compete PHP code demonstrating the problem including code used to connect to the database and create statement.
[23 Mar 2010 15:34]
Moritz Schönauer
<?php
class db {
private $db;
function __construct() {
require('#db.php');
$this->db = new mysqli($host, $user, $pass, $database);
}
function __destruct() {
if(is_object($this->db)) $this->db->close();
}
function news_read($limit = 0) {
if($limit == 0) $qry = "SELECT * FROM news ORDER BY n_id DESC";
else $qry = "SELECT * FROM news ORDER BY n_id DESC LIMIT $limit";
$stmt = $this->db->prepare($qry);
$stmt->execute();
$stmt->bind_result($n_id,$n_title,$n_note,$n_time,$n_author);
while($stmt->fetch()) {
$news = array(id => $n_id, title => $n_title, note => $n_note, time => $n_time, author => $n_author);
$array[] = $news;
}
return $array;
}
}
$db = new db;
$db->news_read();
?>
maybe it is caused by php?
minad ~ # php --version
PHP 5.2.13-pl0-gentoo (cli) (built: Mar 22 2010 18:46:54)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
[24 Mar 2010 6:08]
Sveta Smirnova
Thank you for the feedback. > maybe it is caused by php? Yes, this can be the cause: still no error in my environment. But this can be caused by specific MySQL settings too. Please send us your my.cnf content also.
[24 Mar 2010 13:32]
Moritz Schönauer
http://paste.pocoo.org/show/193248/ <-- my.cnf i tried reinstalling of php and mysql, too, but without success.
[24 Mar 2010 22:35]
Sveta Smirnova
Thank you for the feedback. Problem is PHP of version 5.2.13: I just tried and bug is repeatable as described. While with different version of PHP (5.3 from outdated development sources) bug is not repeatable. Please open bug in PHP bugs database.
[25 Mar 2010 7:09]
Moritz Schönauer
thank you!
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.060 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.