[horde] Horde IMP Quota dovecot errors

Admin Beckspaced admin at beckspaced.com
Wed Mar 8 09:28:24 UTC 2023


Am 07.03.2023 um 09:30 schrieb Admin Beckspaced:
> Dear Horde users,
>
> I have installed Horde (horde) 6.0.0alpha6 with Webmail (imp) 
> 7.0.0alpha13
> install was done via instructions at 
> https://github.com/horde/horde-deployment
>
> all is working fine so far but I also wanted to enable the IMAP quota
> it was working fine with horde version 5.x imp version 6.x running php 
> version 7.4
>
> in /imp/config/backends.local.php quota is enabled as follows
>
> // IMAP server
> $servers['imap'] = array(
>     // ENABLED by default; will connect to IMAP port on local server
>     'disabled' => false,
>     'name' => 'IMAP Server',
>     'hostspec' => 'localhost',
>     ...
>     'quota' => array(
>         'driver' => 'imap',
>         'params' => array(
>             'hide_when_unlimited' => true,
>             'unit' => 'MB'
>         )
>     ),
> );
>
> Browsing to webmail in horde the following error messages appear:
>
> Mar 07 09:08:14 cx20 dovecot[388]: imap-login: Login: 
> user=<admin at beckspaced.com>, method=PLAIN, rip=127.0.0.1, 
> lip=127.0.0.1, mpid=3350, TLS, session=<akfU6Ur2btZ/AAAB>
> Mar 07 09:08:14 cx20 HORDE[2530]: [imp] TypeError: round(): Argument 
> #1 ($num) must be of type int|float, string given in 
> /srv/www/horde/httpdocs/vendor/horde/imp/lib/Ajax/Queue.php:293
> Mar 07 09:08:14 cx20 HORDE[2530]: Stack trace:
> Mar 07 09:08:14 cx20 HORDE[2530]: #0 
> /srv/www/horde/httpdocs/vendor/horde/imp/lib/Ajax/Queue.php(293): round()
> Mar 07 09:08:14 cx20 HORDE[2530]: #1 
> /srv/www/horde/httpdocs/vendor/horde/imp/lib/Ajax/Application.php(145): 
> IMP_Ajax_Queue->add()
> Mar 07 09:08:14 cx20 HORDE[2530]: #2 
> /srv/www/horde/httpdocs/vendor/horde/imp/lib/Ajax/Application.php(134): 
> IMP_Ajax_Application->getTasks()
> Mar 07 09:08:14 cx20 HORDE[2530]: #3 
> /srv/www/horde/httpdocs/vendor/horde/horde/services/ajax.php(70): 
> IMP_Ajax_Application->send()
> Mar 07 09:08:14 cx20 HORDE[2530]: #4 {main} [pid 2530 on line 74 of 
> "/srv/www/horde/httpdocs/vendor/horde/core/lib/Horde/ErrorHandler.php"]
> Mar 07 09:08:14 cx20 dovecot[388]: 
> imap(admin at beckspaced.com)<3350><akfU6Ur2btZ/AAAB>: Disconnected: 
> Logged out in=187 out=1161 deleted=0 expunged=0 trashed=0 hdr_count=0 
> hdr_bytes=0 body_count=0 body_bytes=0
>
> is this error fixable?
>
> I'm currently running php 8.0.28 on an opensuse box leap 15.4
>
> thanks
> & greetings
> Ralf
>
hello there,

did have a look in the source code 
/pathto/vendor/horde/imp/lib/Ajax/Queue.php:293

the error with the quota was actually quite easy to fix.
you just need to cast the variable $quotadata['percent'] as integer and 
the error with displaying the quota for the mailbox is gone.

in case someone runs into the samer error

thanks
& greetings
Ralf

change this

         /* Add quota information. */
         if ($this->_quota &&
             ($quotadata = 
$injector->getInstance('IMP_Quota_Ui')->quota($this->_quota[0], 
$this->_quota[1]))) {
             $ajax->addTask('quota', array(
                 'm' => $quotadata['message'],
                 'p' => round($quotadata['percent']),
                 'l' => $quotadata['percent'] >= 90
                     ? 'alert'
                     : ($quotadata['percent'] >= 75 ? 'warn' : '')
             ));
             $this->_quota = false;
         }

to this

         /* Add quota information. cast as int */
         if ($this->_quota &&
             ($quotadata = 
$injector->getInstance('IMP_Quota_Ui')->quota($this->_quota[0], 
$this->_quota[1]))) {
             $ajax->addTask('quota', array(
                 'm' => $quotadata['message'],
                 'p' => round( (int) $quotadata['percent']),
                 'l' => $quotadata['percent'] >= 90
                     ? 'alert'
                     : ($quotadata['percent'] >= 75 ? 'warn' : '')
             ));
             $this->_quota = false;
         }




More information about the horde mailing list