[PATCH] GIT: Undefined variable when moving categories

Please report bugs here!

Moderator: Thorsten

Post Reply
bram
Posts: 19
Joined: Mon Aug 16, 2010 12:54 pm

[PATCH] GIT: Undefined variable when moving categories

Post by bram »

In the GIT head it appears an undefined variable is used when moving categories.

in phpmyfaq/inc/PMF_Category/Helper.php:

Code: Select all

    public function swapCategories($firstCategoryId, $secondCategoryId)
    {
        $temp_cat = rand(200000, 400000);

        $tables = array(
            array('faqcategories'        => 'id'),
            array('faqcategories'        => 'parent_id'),
            array('faqcategoryrelations' => 'category_id'),
            array('faqquestions'         => 'ask_rubrik'),
            array('faqcategory_group'    => 'category_id'),
            array('faqcategory_user'     => 'category_id'));

        $result = true;
        foreach ($tables as $pair) {
        foreach ($tables as $pair) {
            foreach ($pair as $_table => $_field) {
                $result = $result && $this->db->query(sprintf("UPDATE %s SET %s = %d WHERE %s = %d",
                    SQLPREFIX.$_table,
                    $_field,
                    $temp_cat,
                    $_field,
                    $secondCategoryId));
                $result = $result && $this->db->query(sprintf("UPDATE %s SET %s = %d WHERE %s = %d",
                    SQLPREFIX.$_table,
                    $_field,
                    $secondCategoryId,
                    $_field,
                    $firstCategoryId));
                $result = $result && $this->db->query(sprintf("UPDATE %s SET %s = %d WHERE %s = %d",
                    SQLPREFIX.$_table,
                    $_field,
                    $firstCategoryId,
                    $_field,
                    $temp_cat));
            }
        }

        $result = $this->db->query($query);
        ...

=> where is $query coming from?

Attached is a patch that removes this.
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: [PATCH] GIT: Undefined variable when moving categories

Post by Thorsten »

Hi,

yes, this is obsolete. I removed it in the master branch. Thanks for the hint!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply