未定义的变量:这个

Inside the method i got this line:

if ($db == null && is_object($this) && isset($this->db)) $db = $this->db;

And I got the error above.

I am using PHP 5.2 and have been searching everywhere but seems I'm the only one having this problem.

Any ideas?

I have tried a similar code at http://codepad.viper-7.com/dQLeXu and I got the same error as you do. But my code is outside of a class. is your method static method or instance method?