WildcardSearch / Advanced-Sidebox

A plugin for MyBB forums that displays custom boxes on various forum pages.
GNU General Public License v3.0
20 stars 10 forks source link

PHP Warning: Illegal string offset 'title' #180

Closed Sama34 closed 10 years ago

Sama34 commented 10 years ago
Warning [2] Illegal string offset 'title' - Line: 291 - File: inc/plugins/asb/classes/module.php PHP 5.4.20 (Linux)

This is because the following code:

        // if any templates were dropped in this version
        if(is_array($this->discarded_templates))
        {
            // delete them
            $delete_list = $sep = '';
            foreach($this->discarded_templates as $template)
            {
                $delete_list .= "{$sep}'{$template['title']}'";
                $sep = ',';
            }

            if($delete_list)
            {
                $db->delete_query('templates', "title IN({$delete_list})");
            }
        }

$template within the foreach loop is not an array. Should be:

        // if any templates were dropped in this version
        if(is_array($this->discarded_templates))
        {
            // delete them
            $delete_list = $sep = '';
            foreach($this->discarded_templates as $template_title)
            {
                $delete_list .= "{$sep}'{$template_title}'";
                $sep = ',';
            }

            if($delete_list)
            {
                $db->delete_query('templates', "title IN({$delete_list})");
            }
        }
Sama34 commented 10 years ago

I see this is already fixed in the minor branch. I checked the master one :p

WildcardSearch commented 10 years ago

Yeah we already isolated this one.

We are close to release but I just got a bad cold and I don't feel like working on anything. :frowning: