Home » Database » DB » Bug #2988
"property of non-object" notice when passing table name to tableInfo()
Details
| Submitted | 2004-12-19 01:09 UTC |
|---|---|
| From | timunderwood at gmail dot com |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | 5.0.3 |
| OS | Linux 2.6.9 |
| Roadmaps | (Not assigned) |
Comments
[2004-12-19 01:09 UTC] timunderwood at gmail dot com
Description:
------------
The first line of the DB_mysql::tableInfo appears to be incorrect.
It reads:
if (isset($result->result)) {
But when $result is a string, isset($result->result) returns true:
bash-2.05b$ cat test.php
<?
$string = "Hello";
var_dump(isset($string->result));
?>
bash-2.05b$ php test.php
bool(true)
which means it never hits the "elseif (is_string($result))" case.
So perhaps it should be:
if (is_object($result) && isset($result->result))
-or-
if (is_object($result) && array_key_exists('result', $result))
or something along those lines.
bash-2.05b$ php -v
PHP 5.0.3 (cli) (built: Dec 16 2004 22:01:30)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
[2004-12-20 01:00 UTC] php at com dot jkkn dot dk
Notice that this complements the reported bug in php 5.0.3:
http://bugs.php.net/bug.php?id=31098
Which was caused by an attempt to fix this bug:
http://bugs.php.net/bug.php?id=29883
In CVS 'dmitry' added a automatic typecasting of the offset, so in the exmaple "result" is casted to an int (0) and therefore making isset($result[0]) true.
[2004-12-20 01:56 UTC] timunderwood at gmail dot com
Yeah I didn't see a "5.0.3" in the dropdown menu when submitting the bug which is why I included the "php -v" output.
Thanks for checking this out.