Home » Database » DB » Bug #3833
Supplied parameter misclassified in mysql.php
Details
| Submitted | 2005-03-15 22:41 UTC |
|---|---|
| From | marcus at synchromedia dot co dot uk |
| Assigned | danielc |
| Status | Duplicate |
| Package | DB |
| PHP Version | 5.0.3 |
| OS | RedHat Enterprise Linux 3 |
| Roadmaps | (Not assigned) |
Comments
[2005-03-15 22:41 UTC] marcus at synchromedia dot co dot uk
Description:
------------
The tableInfo method in mysql.php (v 1.74) is
unexpectedly returning a DB_ERROR_NEED_MORE_DATA error.
Line 795 is this:
if (isset($result->result)) {
If I call this method with a simple string (a table
name), it gets misclassified by this test as an object.
I rewrote it as:
if (is_object($result) and array_key_exists('result',
$result)) {
And now it works correctly, classifying the string as a
simple table name. A patch is in the reproduce section.
Reproduce code:
---------------
--- mysql.php.orig 2005-03-15 22:34:26.000000000 +0000
+++ mysql.php 2005-03-15 22:34:04.000000000 +0000
@@ -792,7 +792,7 @@
* @see DB_common::tableInfo()
*/
function tableInfo($result, $mode = null) {
- if (isset($result->result)) {
+ if (is_object($result) and array_key_exists('result', $result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
[2005-03-15 23:01 UTC] marcus at synchromedia dot co dot uk
So why am I seeing it in 1.74? The file I'm looking at
is labelled:
// $Id: mysql.php,v 1.74 2004/04/29 22:42:57 danielc Exp
$
[2005-03-15 23:35 UTC] marcus at synchromedia dot co dot uk
Apologies - I guess it was just an unfortunate
coincidence that the version numbers were so similar.
I'll get onto the package distribution I got it from and
ask them to update.