Bug #15912 [Opn]: MDB2::loadClass can return MDB2_OK without loading class
| From: | daniel dot oconnor at gmail dot com | Date: | Sun, 01 Mar 2009 22:42:44 +0000 |
| Subject: | Bug #15912 [Opn]: MDB2::loadClass can return MDB2_OK without loading class | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-100@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=15912&edit=1
ID: 15912
Updated by: daniel.oconnor@gmail.com
Reported By: pprocacci at bellsouth dot net
Summary: MDB2::loadClass can return MDB2_OK without loading
class
Status: Open
Type: Bug
Package: MDB2
Operating System: FreeBSD 7.0
PHP Version: 5.2.8
Roadmap Versions:
New Comment:
I suspect this will be fixed neatly by namespaces in 5.3; and we
wouldn't change this too much before then...
Previous Comments:
------------------------------------------------------------------------
[2009-02-18 14:03:32] pprocacci
Description:
------------
Forgive me in advance if you believe this is not a bug,
however, I believe extra sanity checking is necessary to ensure the
proper class gets loaded.
Assume the following:
I have my own directory structure that is the same as yours for a
different purpose, yet I named my package the same by chance....
MDB2/Driver/mysql.php
or
The MDB2/Driver/mysql.php is empty..again by chance
or
some other act of god, call it bitrot or whatever.
In the method MDB2::loadClass, it is assumed the include_once calls
make the $class_name you are looking for available. In the event it
doesn't make $class_name available, the call to loadClass succeeds
returning MDB2_OK.
There is definately a small chance of this ever occuring, I realize
this, and can be circumvented pretty easily. I just wanted to bring
this to light for additional thought by your team.
Test script:
---------------
Expected result:
----------------
Actual result:
--------------
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=15912&edit=1