From:             kentfredric at gmail dot com
Operating system: Gentoo GNU/Linux
PHP version:      5.2.6RC5
PHP Bug Type:     MySQLi related
Bug description:  mysqli::get_warnings() is seemingly unusable

Description:
------------
the object returned by mysqli->get_warnings() seems to be completely
undocumented, as well as nonfunctional. 

It should produce at least a text string from the server, but it just
returns an invalid object/resource.

( un-able to see alternative ways to pull warnings programatically, ie:
for use in combination with "explain extended" to display internal
representations of optimized queries as part of our testing/development
phases )

have tested this on 2 different locations with 2 different versions of php
:
 PHP 5.2.6RC4-pl0-gentoo with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 10
2008 08:50:06) (DEBUG)

 PHP 5.2.0 (cli) (built: Apr 11 2007 16:34:30)



Reproduce code:
---------------
$y  = new mysqli(  ......  );
$m  = $y->query( "explain extended select * from footable"); 
while( $row = $m->fetch_assoc() )
{
   print serialize($row) . "\n" ;
}
$n = $y->get_warnings(); 
var_dump( $n ); 
print_r( ReflectionObject::export($n));
var_dump( $n->next() );




Expected result:
----------------
Array Of Warning Records? Array of warning strings? Some Warning? 

( I can't say accurately what expected output would be, as the function is
totally undocumented. But it should produce something instead of nothing in
the above case )


Actual result:
--------------
-- serialized data rows -- 

object(mysqli_warning)#3 (0) {
}

Object of class [ <internal:mysqli> final class mysqli_warning ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Dynamic properties [0] {
  }

  - Methods [2] {
    Method [ <internal:mysqli, ctor> protected method __construct ] {
    }

    Method [ <internal:mysqli> public method next ] {
    }
  }
}

Warning: mysqli_warning::next(): invalid object or resource
mysqli_warning
 in php shell code on line 1
NULL


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

Reply via email to