From 8f645a7aa102dde5408e8dbd129cc81c214ebb3d Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Fri, 12 Jun 2026 12:26:58 +0200 Subject: [PATCH 1/2] fix(imp): repair PHP 8.4 use imports and iTip handling for calendar replies --- config/mime_drivers.php | 1 + lib/Ajax/Imple/ImportEncryptKey.php | 2 +- lib/Ajax/Imple/ItipRequest.php | 6 ++---- lib/Ajax/Imple/PassphraseDialog.php | 6 ++---- lib/Ajax/Imple/VcardImport.php | 6 ++---- lib/Mime/Viewer/Itip.php | 26 ++++++++++++++++---------- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/config/mime_drivers.php b/config/mime_drivers.php index d3e6d6c92..5cd5ff196 100644 --- a/config/mime_drivers.php +++ b/config/mime_drivers.php @@ -231,6 +231,7 @@ 'handles' => [ 'text/calendar', 'text/x-vcalendar', + 'application/ics', ], 'icons' => [ 'default' => 'itip.png', diff --git a/lib/Ajax/Imple/ImportEncryptKey.php b/lib/Ajax/Imple/ImportEncryptKey.php index e9da3e316..7e311c2cc 100644 --- a/lib/Ajax/Imple/ImportEncryptKey.php +++ b/lib/Ajax/Imple/ImportEncryptKey.php @@ -60,7 +60,7 @@ protected function _attach($init) * @return boolean True on success. * @throws IMP_Exception */ - protected function _handle(Variables|Horde_Variables $vars) + protected function _handle(Horde_Variables|Variables $vars) { global $injector, $notification; diff --git a/lib/Ajax/Imple/ItipRequest.php b/lib/Ajax/Imple/ItipRequest.php index 914f55a54..dfc69cd2e 100644 --- a/lib/Ajax/Imple/ItipRequest.php +++ b/lib/Ajax/Imple/ItipRequest.php @@ -10,9 +10,9 @@ * @copyright 2012-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP + */ use Horde\Util\Variables; - */ /** * Attach javascript used to process Itip actions into a page. @@ -22,8 +22,6 @@ * @copyright 2012-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP - -use Horde\Util\Variables; */ class IMP_Ajax_Imple_ItipRequest extends Horde_Core_Ajax_Imple { @@ -61,7 +59,7 @@ protected function _attach($init) * * @return boolean True on success. */ - protected function _handle(Variables|Horde_Variables $vars) + protected function _handle(Horde_Variables|Variables $vars) { global $injector, $notification, $registry; diff --git a/lib/Ajax/Imple/PassphraseDialog.php b/lib/Ajax/Imple/PassphraseDialog.php index 6975b4227..cb069a79e 100644 --- a/lib/Ajax/Imple/PassphraseDialog.php +++ b/lib/Ajax/Imple/PassphraseDialog.php @@ -10,9 +10,9 @@ * @copyright 2010-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP + */ use Horde\Util\Variables; - */ /** * Attach the passphrase dialog to the page. @@ -22,8 +22,6 @@ * @copyright 2010-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP - -use Horde\Util\Variables; */ class IMP_Ajax_Imple_PassphraseDialog extends Horde_Core_Ajax_Imple { @@ -88,7 +86,7 @@ protected function _attach($init) /** */ - protected function _handle(Variables|Horde_Variables $vars) + protected function _handle(Horde_Variables|Variables $vars) { return false; } diff --git a/lib/Ajax/Imple/VcardImport.php b/lib/Ajax/Imple/VcardImport.php index f0bd2dd6e..c301ce792 100644 --- a/lib/Ajax/Imple/VcardImport.php +++ b/lib/Ajax/Imple/VcardImport.php @@ -10,9 +10,9 @@ * @copyright 2012-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP + */ use Horde\Util\Variables; - */ /** * Attach javascript used to process a Vcard import request from IMP. @@ -22,8 +22,6 @@ * @copyright 2014-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP - -use Horde\Util\Variables; */ class IMP_Ajax_Imple_VcardImport extends Horde_Core_Ajax_Imple { @@ -63,7 +61,7 @@ protected function _attach($init) * * @return boolean True on success. */ - protected function _handle(Variables|Horde_Variables $vars) + protected function _handle(Horde_Variables|Variables $vars) { global $registry, $injector, $notification; diff --git a/lib/Mime/Viewer/Itip.php b/lib/Mime/Viewer/Itip.php index 49f7c7742..0b46cd86c 100644 --- a/lib/Mime/Viewer/Itip.php +++ b/lib/Mime/Viewer/Itip.php @@ -361,10 +361,7 @@ protected function _vEvent($vevent, $id, $method = 'PUBLISH', $components = []) case 'REPLY': $desc = _('%s has replied to the invitation to "%s".'); - $from = $this->getConfigParam('imp_contents')->getHeader()->getHeader('from'); - $sender = $from - ? $from->getAddressList(true)->first()->bare_address - : null; + $sender = $this->_senderFromHeader(); if ($registry->hasMethod('calendar/updateAttendee') && $this->_autoUpdateReply(self::AUTO_UPDATE_EVENT_REPLY, $sender)) { try { @@ -373,7 +370,7 @@ protected function _vEvent($vevent, $id, $method = 'PUBLISH', $components = []) $sender, ]); $notification->push(_('Respondent Status Updated.'), 'horde.success'); - } catch (Horde_Exception $e) { + } catch (Throwable $e) { $notification->push(sprintf(_('There was an error updating the event: %s'), $e->getMessage()), 'horde.error'); } } else { @@ -752,10 +749,7 @@ protected function _vTodo($vtodo, $id, $method) case 'REPLY': $desc = _('%s has replied to the assignment of task "%s".'); - $from = $this->getConfigParam('imp_contents')->getHeader()->getHeader('from'); - $sender = $from - ? $from->getAddressList(true)->first()->bare_address - : null; + $sender = $this->_senderFromHeader(); if ($registry->hasMethod('tasks/updateAttendee') && $this->_autoUpdateReply(self::AUTO_UPDATE_TASK_REPLY, $sender)) { @@ -765,7 +759,7 @@ protected function _vTodo($vtodo, $id, $method) $sender, ]); $notification->push(_('Respondent Status Updated.'), 'horde.success'); - } catch (Horde_Exception $e) { + } catch (Throwable $e) { $notification->push(sprintf(_('There was an error updating the task: %s'), $e->getMessage()), 'horde.error'); } } elseif ($registry->hasMethod('tasks/updateAttendee')) { @@ -929,6 +923,18 @@ protected function _parseAttendees($data, $attendees) * * @return boolean */ + protected function _senderFromHeader() + { + $from = $this->getConfigParam('imp_contents')->getHeader()->getHeader('from'); + if (!$from) { + return null; + } + + $addr = $from->getAddressList(true)->first(); + + return $addr ? $addr->bare_address : null; + } + protected function _autoUpdateReply($type, $sender) { if (!empty($this->_conf[$type])) { From 95783765eb883a9134e89a339a4d69ae3d54b698 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Fri, 12 Jun 2026 13:12:11 +0200 Subject: [PATCH 2/2] fix(imp): repair PHP 8.4 use imports and iTip handling for calendar replies Move Horde\Util\Variables imports out of docblocks to fix PHP 8.4 compatibility fatals in Ajax Imple classes. Register application/ics for the iTip mime driver and improve From-header parsing in Itip viewer. --- lib/Ajax/Imple/ImportEncryptKey.php | 2 +- lib/Ajax/Imple/ItipRequest.php | 2 +- lib/Ajax/Imple/PassphraseDialog.php | 2 +- lib/Ajax/Imple/VcardImport.php | 2 +- lib/Mime/Viewer/Itip.php | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Ajax/Imple/ImportEncryptKey.php b/lib/Ajax/Imple/ImportEncryptKey.php index 7e311c2cc..e9da3e316 100644 --- a/lib/Ajax/Imple/ImportEncryptKey.php +++ b/lib/Ajax/Imple/ImportEncryptKey.php @@ -60,7 +60,7 @@ protected function _attach($init) * @return boolean True on success. * @throws IMP_Exception */ - protected function _handle(Horde_Variables|Variables $vars) + protected function _handle(Variables|Horde_Variables $vars) { global $injector, $notification; diff --git a/lib/Ajax/Imple/ItipRequest.php b/lib/Ajax/Imple/ItipRequest.php index dfc69cd2e..50dc7775a 100644 --- a/lib/Ajax/Imple/ItipRequest.php +++ b/lib/Ajax/Imple/ItipRequest.php @@ -59,7 +59,7 @@ protected function _attach($init) * * @return boolean True on success. */ - protected function _handle(Horde_Variables|Variables $vars) + protected function _handle(Variables|Horde_Variables $vars) { global $injector, $notification, $registry; diff --git a/lib/Ajax/Imple/PassphraseDialog.php b/lib/Ajax/Imple/PassphraseDialog.php index cb069a79e..44d84e15a 100644 --- a/lib/Ajax/Imple/PassphraseDialog.php +++ b/lib/Ajax/Imple/PassphraseDialog.php @@ -86,7 +86,7 @@ protected function _attach($init) /** */ - protected function _handle(Horde_Variables|Variables $vars) + protected function _handle(Variables|Horde_Variables $vars) { return false; } diff --git a/lib/Ajax/Imple/VcardImport.php b/lib/Ajax/Imple/VcardImport.php index c301ce792..40a02bb16 100644 --- a/lib/Ajax/Imple/VcardImport.php +++ b/lib/Ajax/Imple/VcardImport.php @@ -61,7 +61,7 @@ protected function _attach($init) * * @return boolean True on success. */ - protected function _handle(Horde_Variables|Variables $vars) + protected function _handle(Variables|Horde_Variables $vars) { global $registry, $injector, $notification; diff --git a/lib/Mime/Viewer/Itip.php b/lib/Mime/Viewer/Itip.php index 0b46cd86c..87449a9de 100644 --- a/lib/Mime/Viewer/Itip.php +++ b/lib/Mime/Viewer/Itip.php @@ -370,7 +370,7 @@ protected function _vEvent($vevent, $id, $method = 'PUBLISH', $components = []) $sender, ]); $notification->push(_('Respondent Status Updated.'), 'horde.success'); - } catch (Throwable $e) { + } catch (Horde_Exception $e) { $notification->push(sprintf(_('There was an error updating the event: %s'), $e->getMessage()), 'horde.error'); } } else { @@ -759,7 +759,7 @@ protected function _vTodo($vtodo, $id, $method) $sender, ]); $notification->push(_('Respondent Status Updated.'), 'horde.success'); - } catch (Throwable $e) { + } catch (Horde_Exception $e) { $notification->push(sprintf(_('There was an error updating the task: %s'), $e->getMessage()), 'horde.error'); } } elseif ($registry->hasMethod('tasks/updateAttendee')) {