Re: Bug in DB::tableInfo mysql - php5.0.3
| From: | Matt Friedman | Date: | Wed, 19 Jan 2005 20:58:30 +0000 |
| Subject: | Re: Bug in DB::tableInfo mysql - php5.0.3 | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35616@lists.php.net to get a copy of this message | ||
Here's a patch/workaround for this issue. I generated it, so I thought
I'd share it - someone might find it useful.
<start of patch>
--- mysql.php.orig 2005-01-19 14:57:51.000000000 -0500
+++ mysql.php 2005-01-19 14:59:22.000000000 -0500
@@ -792,7 +792,7 @@
* @see DB_common::tableInfo()
*/
function tableInfo($result, $mode = null) {
- if (isset($result->result)) {
+ if (is_object($result) && isset($result->result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
<end of patch>
On Tue, 18 Jan 2005 16:26:48 -0500, Matt Friedman
<matt.friedman@gmail.com> wrote:
> Has anyone noticed a bug in DB::tableInfo (mysql and php5.0.3)
> where if you pass a string the first condition returns true and as
> such you get a
> `Trying to get property of non-object error.'
>
> For example
> If I call DB::tableInfo("mytable")
>
> // here is what happens...
> if(isset($result->result)) {
> // the isset here returns true even when passed a string.
> }
>
> is this a bug in php or DB? Is there a workaround someone can suggest?
>
> If it is a DB bug, let me know and I'll put in a bug report.
>
> Thanks,
> --
> Matt Friedman
>
> "A good engineer is a person who makes a design that works with as few
> original ideas as possible. There are no prima donnas in engineering."
> -- Freeman Dyson
>
--
Matt Friedman
"A good engineer is a person who makes a design that works with as few
original ideas as possible. There are no prima donnas in engineering."
-- Freeman Dyson