[dev] Questions about MIME_Viewer

Michael M Slusarz slusarz at bigworm.colorado.edu
Tue Jan 7 10:23:58 PST 2003


Quoting "Brent J. Nordquist" <bjn at horde.org>:

| (1)  In horde/lib/MIME/Viewer.php line 93:
| 
| 	MIME_Viewer::includeDriver calls _getDriver, and then uses two
| values from $ob -- however, _getDriver can legally return false (as
| opposed to an object) as documented in the comment above _getDriver.
| Shouldn't there be a check here that will prevent the call to
| resolveDriver if $ob is false?  (I found it strange that the call
| $ob->driver isn't producing a "not an object" error or something.)  But
| at any rate, resolveDriver produces a nonsensical path when its arguments
| are empty ("/lib/MIME/Viewer/.php") and then you get a file-not-found
| error on include later on.

This has been fixed.

| (2)  The way Orator is currently set up, and from comments like the
| following in horde's MIME_Viewer, I am inferring that Horde apps are
| allowed to use Horde's MIME viewer classes:
| 
|     /* Figure the correct driver for this MIME type. If there is no
|        application-specific module, a general Horde one will attempt to
|        be used. */
| 
| The problem is, I can't see how this could work as the code is now.  The
| calling chain:
| 
|     MIME_Viewer::factory($mime_part, $mime_type)
|         MIME_Viewer::includeDriver($mime_type)
|             MIME_Viewer::_getDriver($mime_type, $registry->getApp())
| 
| (note how _getDriver is always called with the current app. -- in my
| case, 'orator')

_getDriver() recursively calls itself with 'horde' as the $app parameter if 
no exact MIME_Viewer match is found in the application.  So this code is OK.

michael

______________________________________________
Michael Slusarz [slusarz at bigworm.colorado.edu]


More information about the dev mailing list