Home » Database » DB » Bug #769
Failing to include db-specific files is a fatal error but produces no error msg
Details
| Submitted | 2004-02-16 09:25 UTC |
|---|---|
| From | jocke at selincite dot com |
| Status | Bogus |
| Package | DB |
| PHP Version | Irrelevant |
| OS | Any |
| Roadmaps | (Not assigned) |
Comments
[2004-02-16 09:25 UTC] jocke at selincite dot com
Description:
------------
Hi,
This isn't really a bug as such, but more of a "misunderstanding" in the coding philosophy.
This strange behaviour occurrs when PEAR is not in the PHP-include path and DB.php is trying to include a DB-specific file (mysql.php, pgsql.php)
DB.php: DB::connect()
----
273 if (is_array($options) && isset($options["debug"]) &&
274 $options["debug"] >= 2) {
275 // expose php errors with sufficient debug level
276 include_once "DB/${type}.php";
277 } else {
278 @include_once "DB/${type}.php";
279 }
----
If line 278 fails, there will be no error messages, and the whole DB-class and it's execution fails. This is a fatal error and, IMHO, should produce an error message no matter what error/debug level.
This behaviour occurred when I included DB.php manually with require_once(), without having anything other than "." in the include path. I was using Windows at that occasion. One strange thing is that since DB.php was included, the path from there should have been "DB/mysql.php" or "DB/pgsql.php", but that did apparently not work. This behaviour caused quite a bit of confusion, but was solved with adding PHP-dir to the include path. With an error message this could have been corrected immediately.
Thanks for your time.
/Jocke
[2004-02-16 09:51 UTC] jocke at selincite dot com
Setting the debug level is not the point of my submission. The point is that it's a fatal error that prevents the application from running, and thus, it should display an error message (regardless of debug level).
For example, if you ship code to a live environment you don't want (or should) be running debug-levels. The code should, however, inform you of fatal problems (especially if they are related to environment differences).