• PHP Warning:  Trying to access array offset on value of type null in /chroot/home/USER/DOMAIN/html/wp-content/plugins/cryptx/include/functions.php on line 428

    Ran into this error when using WP-CLI. When using WP-CLI not all globals are available, if you could just put in a check that the variable exists that should do it. It’s in this part:

    /**
     *  add ID to exclude list
     */
    function rw_cryptx_insert_post($pID) {
        global $cryptX_var, $post;
        $rev = wp_is_post_revision($pID);
        if($rev) $pID = $rev;
        $b = explode(",", $cryptX_var['excludedIDs']); // LINE 428
        if($b[0] == '') unset($b[0]);
        foreach($b as $x=>$y) {
            if($y == $pID) {
                unset($b[$x]);
                break;
            }
        }
        if (isset($_POST['cryptxoff'])) $b[] = $pID;
        $b = array_unique($b);
        sort($b);
        $cryptX_var['excludedIDs'] = implode(",", $b);
        update_option( 'cryptX', $cryptX_var);
        $cryptX_var = rw_loadDefaults(); // reread Options
    }

    CryptX 3.3.3.2 / WordPress 6.2 / PHP 8.0.28

  • The topic ‘Error when using WP-CLI’ is closed to new replies.