php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54385 Mysqli_stmt->get_result() gives no error on failure
Submitted: 2011-03-25 23:28 UTC Modified: 2011-03-26 05:30 UTC
From: four dot zero dot one dot un dot authorized at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.3.6 OS: ms
Private report: No CVE-ID: None
 [2011-03-25 23:28 UTC] four dot zero dot one dot un dot authorized at gmail dot com
Description:
------------
Though mysqli_stmt->get_result() returns false on failure as expected, it doesn't also generate an error on failure.  Can warning-level errors be added to help explain when/why a get fails?

Thanks,
401

Test script:
---------------
$m = new Mysqli();
$s = $m->prepare("SELECT * FROM test where(id = ?)");
$v = 1;
$s->bind_param('i', $v);
$s->execute();
$s->store_result(); // cause of get_result's failure
$r = $s->get_result();


Expected result:
----------------
Warning-level error on get_result() line 9 explaining why results failed to return from method call, or at the very least a warning stating a failure of some kind occurred.

Actual result:
--------------
No warning generated.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-26 00:54 UTC] four dot zero dot one dot un dot authorized at gmail dot com
Actually, my bad.  You can close this.  I just found that the error "2014 Commands out of sync; you can't run this command now" is already stored in the main Mysqli object error properties after running the code example.  This works.
 [2011-03-26 05:30 UTC] pierrick@php.net
-Status: Open +Status: Bogus
 [2011-03-26 05:30 UTC] pierrick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC