#32928 [Opn->Csd]: php dies trying to ->bind_result(...)

From: Date: Sat, 07 May 2005 06:44:57 +0000
Subject: #32928 [Opn->Csd]: php dies trying to ->bind_result(...)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78750@lists.php.net to get a copy of this message
ID: 32928 Updated by: andrey@php.net Reported By: dan at yes dot lt -Status: Open +Status: Closed Bug Type: MySQLi related Operating System: winxp PHP Version: 5.0.4, 5.0.5-dev Assigned To: georg New Comment: Your example is broken - you don't call execute() on the prepared statement object. However, this reveals another problem - whenever a unbuffered query is used (mysqli_stmt_store_result not called) the wire has to be cleaned before the next prepare. One call to fetch() does not help. Previous Comments: ------------------------------------------------------------------------ [2005-05-06 16:48:35] dan at yes dot lt Still crashes for me with latest 5.0.5-dev... Just forgot to write ->execute() in sample. MySQL version 5.0.4 - may be this is important. // This works $db = new mysqli(...); $st = $db->prepare("SELECT 1 AS test"); $st->execute(); $st->bind_result($x); $st->fetch(); var_dump($x); // This crashes $db = new mysqli(...); $st = $db->prepare("SELECT 1.23 AS test"); $st->execute(); $st->bind_result($x); $st->fetch(); var_dump($x); // This crashes too $db = new mysqli(...); $st = $db->prepare("SELECT NULL AS test"); $st->execute(); $st->bind_result($x); $st->fetch(); var_dump($x); ------------------------------------------------------------------------ [2005-05-06 15:43:28] georg@php.net Doesn't crash here (tested against PHP-5.0.5-dev and PHP-5.1.0-dev) and returns NULL as expected. Please reread the documentation on how to work with prepared statements. It makes no sense to fetch a value from a prepared statement without executing it before. ------------------------------------------------------------------------ [2005-05-06 08:44:06] dan at yes dot lt php also dies with latest snapshot ------------------------------------------------------------------------ [2005-05-06 03:14:55] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip ------------------------------------------------------------------------ [2005-05-05 15:47:53] dan at yes dot lt this is not NULL or unbuffered resultset only... try this: Reproduce code: --------------- $st = $db->prepare("SELECT 1.23 AS test"); $st->bind_result($x); $st->fetch(); var_dump($x); Expected result: ---------------- float(1.23) Actual result: -------------- ...FATAL ERROR WITH NO OUTPUT... or maybe floats are also unsupported ?.. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/32928 -- Edit this bug report at http://bugs.php.net/?id=32928&edit=1

« previous php.bugs (#78750) next »