Bug #51386 [Asn]: mysql tries to allocate 4294967296 bytes when fetching longtext via mysqli

[email protected] Wed, 7 Apr 2010 20:37:42 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at http://bugs.php.net/bug.php?id=51386&edit=1

 ID:               51386
 Updated by:       [email protected]
 Reported by:      rellig at minad dot de
 Summary:          mysql tries to allocate 4294967296 bytes when fetching
                   longtext via mysqli
 Status:           Assigned
 Type:             Bug
 Package:          MySQLi related
 Operating System: gentoo
 PHP Version:      5.2.13
 Assigned To:      mysql

 New Comment:

From the link:

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";
	echo $qry;
	$stmt = $this->db->prepare($qry);
	$stmt->execute();
	$stmt->bind_result($n_id,$n_title,$n_note,$n_time,$n_author);
	while($stmt->fetch()) {
		$n_ids[] = $n_id;
		$n_titles[] = $n_title;
		$n_notes[] = $n_note;
		$n_times[] = $n_time;
		$n_authors[] = $n_author;
		$stmnt->free_result;
	}
	$stmt->close();
	return array(ids => $n_ids, titles => $n_titles, notes => $n_notes,
times => $n_times, authors => $n_authors);
}


Previous Comments:
------------------------------------------------------------------------
[2010-03-25 08:19:55] rellig at minad dot de

Description:
------------
I wanted to fetch some lines in a php script via
mysqli-prepared-statement and got this
error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate
4294967296 bytes)
I was confused because php reportet that this error occured at
bind_result.
After some time I figured out that it works when I turn one field with
LONGTEXT type to
VARCHAR, for example.

here is a link to my php-script:
http://paste.minad.de/?nid=216


you can look at http://bugs.mysql.com/bug.php?id=52234 too.




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51386&edit=1