Skip to content

bug: FRAMEWORK_6_0 broken after #123 (parse errors, missing Horde\Imp\ImpConfig class) #128

Open

Description

@TDannhauer

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\ImpConfig does not exist (nothing in src/, no injector binding),
  • two of the three files no longer parse,
  • two methods use $injector without 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 named ImpConfig. The use Horde\Imp\ImpConfig; import has no effect on a string literal, and Horde\Imp\ImpConfig does not exist either. Every creation of IMP_Sentmail throws.

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'); inside renderMIMEPart(), where $injector is undefined (no parameter, no global).
  • mime.magic_db is a Horde-wide key (horde conf.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') inside delete(), where $injector is 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_Contents cannot be autoloaded. Any request that needs it (message display, MIME part rendering, and everything else going through IMP_Factory_Contents) dies with a ParseError.
  • IMP_Compose_LinkedAttachment cannot be autoloaded: attachment.php, linked attachments in compose, and IMP_Compose_Attachment_Storage_VfsLinked.
  • IMP_Sentmail cannot be created: sentmail logging on send/redirect/MDN, favouriteRecipients in 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

  1. Revert d79afbe on FRAMEWORK_6_0 to get the branch working again.
  2. Add Horde\Imp\ImpConfig in src/ImpConfig.php with its injector binding (same shape as WickedConfig, IngoConfig, KronolithConfig, ...) before any call site is converted.
  3. 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',
    • $injector has to be in scope at the call site (or the config injected),
    • only IMP-owned keys go through ImpConfig; Horde-wide keys such as mime.magic_db stay with the horde config.
  4. A php -l step in CI would have caught the two parse errors before merge.

Test plan for the follow-up

  • php -l passes for all files under lib/ and src/
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions