Edit report at https://bugs.php.net/bug.php?id=61446&edit=1

 ID:                 61446
 Updated by:         u...@php.net
 Reported by:        dasmag at gmail dot com
 Summary:            Can't prepare statement without getting a result
 Status:             Open
 Type:               Bug
 Package:            MySQLi related
 Operating System:   ubuntu 11.04
 PHP Version:        5.3.10
-Assigned To:        
+Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

Very good find! Thanks! 

Andrey, mysqlnd sets an appropriate error message but we do not copy it into 
mysqli. mysqli has code for libmysql but not for mysqlnd. Maybe the copy was 
not needed for mysqlnd in the past?

>mysqlnd_stmt::prepare
| info : stmt=0
| info : query=SELECT 2
| >mysqlnd_conn_data::simple_command
| | info : command=STMT_PREPARE ok_packet=13 silent=0
| | >mysqlnd_conn_data::get_state
| | <mysqlnd_conn_data::get_state
| | >_mysqlnd_pestrdup
| | | info : file=mysqlnd.c       line= 326
| | | info : ptr=0x893d594
| | <_mysqlnd_pestrdup
| | info : adding error [Commands out of sync; you can't run this command now] 
to the list
| | >mysqlnd_conn_data::get_state
| | <mysqlnd_conn_data::get_state
| | error: Command out of sync. State=4
| <mysqlnd_conn_data::simple_command
| info : FAIL
<mysqlnd_stmt::prepare
>mysqlnd_stmt::dtor


Previous Comments:
------------------------------------------------------------------------
[2012-03-19 23:25:42] dasmag at gmail dot com

Description:
------------
---
>From manual page: http://www.php.net/mysqli.prepare
---

There are an error if I heven't got a result from statement.
Just execute the script with and without commented string.
And there are no description in the documentation.

Test script:
---------------
<?php
        $mysqli = new mysqli("localhost");
        $st = $mysqli->prepare("SELECT 1");
        $st->execute();
        // print_r($st->get_result()->fetch_assoc());
        
        $st = $mysqli->prepare("SELECT 2");
        $st->execute();
?>

Actual result:
--------------
Fatal error: Call to a member function execute() on a non-objec


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



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

Reply via email to