php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44880 mysqli::get_warnings() is seemingly unusable
Submitted: 2008-05-01 13:35 UTC Modified: 2008-07-14 17:02 UTC
From: kentfredric at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.6RC5 OS: Gentoo GNU/Linux
Private report: No CVE-ID: None
 [2008-05-01 13:35 UTC] kentfredric at gmail dot com
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-14 17:02 UTC] uw@php.net
This is an experimental feature. Experimental features are not supposed to behave in a sane way.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC