PHP Warning: Undefined array key "trash_mbox_iswitch"

Issue #82 resolved
Xuo created an issue

Hi,

I’m using ident_switch 4.3.5 with roundcubemail 1.5.

Everything seems working but I get a lot of Php warnings like :

PHP Warning: Undefined array key "drafts_mbox_iswitch" in /usr/share/roundcubemail-1.5.0/plugins/ident_switch/ident_switch.php on line 72
PHP Warning: Undefined array key "sent_mbox_iswitch" in /usr/share/roundcubemail-1.5.0/plugins/ident_switch/ident_switch.php on line 72
PHP Warning: Undefined array key "junk_mbox_iswitch" in /usr/share/roundcubemail-1.5.0/plugins/ident_switch/ident_switch.php on line 72
PHP Warning: Undefined array key "trash_mbox_iswitch" in /usr/share/roundcubemail-1.5.0/plugins/ident_switch/ident_switch.php on line 72

Do you know how to remove these warnings ?

regards.

Xuo.

Comments (4)

  1. Gergely Papp

    This is due to the new PHP defaults, adding isset instead of presuming null for unset array values removes this warning.

    72c72
    <                       $val = $_SESSION[$otherKey] ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
    ---
    >                       $val = isset($_SESSION[$otherKey]) ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
    110c110
    <               $accNames = array($_SESSION['global_alias'] ? $_SESSION['global_alias'] : $rc->user->data['username']);
    ---
    >               $accNames = array(isset($_SESSION['global_alias']) ? $_SESSION['global_alias'] : $rc->user->data['username']);
    668c668
    <                               if ($_SESSION[$otherKey])
    ---
    >                               if (isset($_SESSION[$otherKey]))
    696c696
    <                                                       if (!$_SESSION[$k . self::MY_POSTFIX])
    ---
    >                                                       if (!isset($_SESSION[$k . self::MY_POSTFIX]))
    706c706
    <                                               if (!$_SESSION[$k . self::MY_POSTFIX])
    ---
    >                                               if (!isset($_SESSION[$k . self::MY_POSTFIX]))
    739c739
    <                                       if ($r[$type . '_mbox']) {
    ---
    >                                       if (isset($r[$type . '_mbox'])) {
    

  2. Xuo reporter

    Hi,

    Thank you for your answer. This is what I did after I’ve searched for similar issues on Internet.

    Do you know if it would be possible to correct all the code the way you did it to avoid the lost of these changes when a new version will be available ?

    Regards.

    Xuo.

  3. Log in to comment