From:             jochen dot wiedmann at gmail dot com
Operating system: Fedora Linux 10
PHP version:      5.2.9
PHP Bug Type:     MySQLi related
Bug description:  Unable to combine prepared statements and fetch_row

Description:
------------
This is a follow up to bug 45289, which has been closed due to missing
feedback. I have checked the latest snapshot (php5.2-200905151830), whether
the problem still persists by using the script below. (Should be easy to
derive a .phpt file from it.)


Reproduce code:
---------------
<?php
  $mysqli = mysqli_init();
  $mysqli->real_connect("localhost", "root", null, 'test');
  if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
  }
  $mysqli->query("DROP TABLE IF EXISTS prep_and_fetch_row")
    or die($mysqli->error);
  $mysqli->query("CREATE TABLE prep_and_fetch_row(id BIGINT NOT NULL
PRIMARY KEY, name VARCHAR(64) NOT NULL)")
    or die($mysqli->error);
  $mysqli->query("INSERT INTO prep_and_fetch_row (id, name) VALUES (1,
'abc')")
    or die($mysqli->error);
  $stmt = $mysqli->prepare("SELECT * FROM prep_and_fetch_row WHERE
id=?")
    or die($mysqli->error);
  $id = "1";
  $stmt->bind_param("i", $id)  or die($mysqli->error);
  $stmt->execute() or die($mysqli->error);
  $result = $mysqli->use_result() or die($mysqli->error);
  while ($row = $result->fetch_row()) {
    print "----- result row -----------\n";
    print_r($row);
  }
  print "----- no more results -----------\n";

  $mysqli->query("DROP TABLE prep_and_fetch_row") or
die($mysqli->error);
  $mysqli->close();
?>


Expected result:
----------------
Expected output: Something like

----- result row -----------
Array
(
    [0] => int(1)
    [1] => string(3) "abc"
)
----- no more results -----------


Actual result:
--------------
Actual output:

----- result row -----------
Array
(
    [0] => 
    [1] => 
)
----- no more results -----------


-- 
Edit bug report at http://bugs.php.net/?id=48373&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48373&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48373&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48373&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48373&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48373&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48373&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48373&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48373&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48373&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48373&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48373&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48373&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48373&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48373&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48373&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48373&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48373&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48373&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48373&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48373&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48373&r=mysqlcfg

Reply via email to