Repository navigation
Description
Summary
FRAMEWORK_6_0 is broken since the merge of #123 ("Attempt to address issue #114", merge commit f560f9b, change commit d79afbe). The PR converts three files from $conf to ImpConfig, but:
- the class
Horde\Imp\ImpConfigdoes not exist (nothing insrc/, no injector binding), - two of the three files no longer parse,
- two methods use
$injectorwithout having it in scope.
Observed
First access to IMP after login showed the generic "server misconfiguration" error page once; a reload rendered IMP normally. Horde log:
emergency: [imp] Cannot create ImpConfig
Root cause: Class ImpConfig does not exist [... on line 499 of ".../vendor/horde/injector/src/Injector.php"]
Findings per file (at f560f9b)
lib/Factory/Sentmail.php
- L39:
$injector->get('ImpConfig')asks for a global class namedImpConfig. Theuse Horde\Imp\ImpConfig;import has no effect on a string literal, andHorde\Imp\ImpConfigdoes not exist either. Every creation ofIMP_Sentmailthrows.
lib/Contents.php
- L607: parse error, unbalanced parenthesis:
$options['type'] = Horde_Mime_Magic::analyzeFile($tempfile, empty($config->get('mime.magic_db') ? null : $config->get('mime.magic_db');
- L588:
$config = $injector->get('ImpConfig');insiderenderMIMEPart(), where$injectoris undefined (no parameter, noglobal). mime.magic_dbis a Horde-wide key (hordeconf.php), not an IMP key, so it should not be read from the app config object at all.
lib/Compose/LinkedAttachment.php
- L111 and L190: parse errors, unbalanced parenthesis in both
empty($config->get('compose.link_attachments_notify')conditions. - L109:
$injector->get('ImpConfig')insidedelete(), where$injectoris undefined. - L63, L109, L189: same string lookup of the non-existent class.
php -l result:
PHP Parse error: syntax error, unexpected token ";" in lib/Contents.php on line 607
PHP Parse error: syntax error, unexpected token "{" in lib/Compose/LinkedAttachment.php on line 113
No syntax errors detected in lib/Factory/Sentmail.php
Impact
IMP_Contentscannot be autoloaded. Any request that needs it (message display, MIME part rendering, and everything else going throughIMP_Factory_Contents) dies with aParseError.IMP_Compose_LinkedAttachmentcannot be autoloaded:attachment.php, linked attachments in compose, andIMP_Compose_Attachment_Storage_VfsLinked.IMP_Sentmailcannot be created: sentmail logging on send/redirect/MDN,favouriteRecipientsin the API, the sentmail permission check, and the weekly garbage collection login task.
Why it looked intermittent
The log entry comes from IMP_LoginTasks_SystemTask_GarbageCollection (weekly, admin only), which calls IMP_Sentmail->gc(). Horde_LoginTasks_Tasklist::ready() removes system tasks from the list before they are executed, so after the exception the reload finds an empty list and markLastRun() records the run as done. The error then stays hidden until the next weekly run, and the garbage collection for sentmail and compose attachments is skipped silently. That masking behaviour lives in horde/logintasks and may deserve its own issue.
Suggested fix
- Revert d79afbe on
FRAMEWORK_6_0to get the branch working again. - Add
Horde\Imp\ImpConfiginsrc/ImpConfig.phpwith its injector binding (same shape asWickedConfig,IngoConfig,KronolithConfig, ...) before any call site is converted. - Update the recipe in Convert imp from global $conf to ImpConfig #114, since the PR followed it literally:
$injector->get(ImpConfig::class)instead of the string'ImpConfig',$injectorhas to be in scope at the call site (or the config injected),- only IMP-owned keys go through
ImpConfig; Horde-wide keys such asmime.magic_dbstay with the horde config.
- A
php -lstep in CI would have caught the two parse errors before merge.
Test plan for the follow-up
-
php -lpasses for all files underlib/andsrc/ - Open a message in dynamic view (exercises
IMP_Contents::renderMIMEPart()) - Send a mail with sentmail logging enabled (exercises
IMP_Factory_Sentmail) - Download and delete a linked attachment (exercises
IMP_Compose_LinkedAttachment) - Admin login with a due weekly login task completes without error
Activity