Doc #67046 [NEW]: mysqli_stmt::free_result also clears result bindings

From: Date: Wed, 09 Apr 2014 03:16:48 +0000
Subject: Doc #67046 [NEW]: mysqli_stmt::free_result also clears result bindings
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11135@lists.php.net to get a copy of this message
From: jon dot kloske at gmail dot com Operating system: PHP version: Irrelevant Package: MySQLi related Bug Type: Documentation Problem Bug description:mysqli_stmt::free_result also clears result bindings Description: ------------ --- From manual page: http://www.php.net/mysqli-stmt.free-result --- "mysqli_stmt::free_result -- mysqli_stmt_free_result — Frees stored result memory for the given statement handle" It also clears the result bindings, so that you need to call mysqli_stmt::bind_result again if you're going to use the prepared statement a second time after this. In spite of the manual for bind_result saying that it must be called after execute, this doesn't appear to actually be required in all the testing I've done. Ie, if you have a prepared statement that returns a name column based off an id, you can bind $id to the id in the parameter and $name to the name result at the end before calling execute and it seems to work fine. You can then keep changing $id and calling execute and fetch and $name gets filled correctly. If you however call free_result after the fetch (ie, if you're using store_result) the next time you run execute $name isn't bound to the result. The manual page isn't particularly clear on these unintended side effects of free_result since all it says is it frees the stored result memory, not also the bindings... -- Edit bug report at https://bugs.php.net/bug.php?id=67046&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67046&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67046&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67046&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67046&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67046&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67046&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67046&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67046&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67046&r=support Expected behavior: https://bugs.php.net/fix.php?id=67046&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67046&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67046&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67046&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67046&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67046&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67046&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67046&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67046&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67046&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67046&r=mysqlcfg

« previous php.doc.bugs (#11135) next »