[dev] BUG horde/lib/mime/viewer/smime.php

Mike Cochrane mike@graftonhall.co.nz
Thu, 8 Aug 2002 06:13:43 +0100


there's an infinite recursion bug in smime.php caused my (i suspect) a bug in
MIME_Part.

Here's the offending code (with some debuging code):

 function resolveViewer()
    {
        static $depth;
        if ($depth > 5) return false;
        Horde::logMessage('SMIME::resolveViwer() depth:' . $depth++, __FILE__,
__LINE__, LOG_DEBUG);

        $viewer = null;
        if (empty($this->viewer)) {

//            var_dump($this->mime_part->getContentTypeParameter('protocol'));

            $viewer = MIME_Viewer::factory($this->mime_part,
$this->mime_part->getContentTypeParameter('protocol'));
            if (empty($viewer) || $viewer === false || get_class($viewer) ==
'mime_viewer_default') {
                $viewer = MIME_Viewer::factory($this->mime_part,
$this->mime_part->getPrimaryType() . '/*');
                if (empty($viewer) || $viewer === false) {
                    return false;
                }
            }
            $this->viewer = $viewer;
        }

        return true;
    }

The Problem:
the $this->mime_part->getContentTypeParameter('protocol') call always returns
false as the 'protocol' parameter is never set in MIME_Part. 
this causes MIME_Viewer::factory() to return another MIME_Viewer_smime and we
recurse indefinatly. I have no idea what is different about my system here that
noone else has notices this. PHP just recurses until if FAULTs here... Win32.

The 3 lines at the top of the code are my debugging code and to stop it recusing
too far.

And idea's Michael?

Thanks

- Mike :-)

--

-------------------------------------------------------------------------
This mail sent from Mike's CVS HEAD install of IMP: http://horde.org/imp/