plugin freetag, related tags bug (<)

Found a bug? Tell us!!
Post Reply
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

plugin freetag, related tags bug (<)

Post by Timbalu »

This (array) inside foreach disables non-array warnings and produces a fatal '<' => 0 tags content.

Code: Select all

1309 	foreach((array)$rows as $r) {
replace function with added if(is_array($rows)):

Code: Select all

    #
    # descend: if true, get the related tags of the related tags of given tag
    #
    function getTagCloudTags($tag, $descend = true) {
        $rows = serendipity_db_query($this->getTagCloudQuery('', $tag));
        if(is_array($rows)) {
            foreach($rows as $r) {
                $tags[$r['tag']] = $r['total'];

                #get also tags which are related only by other tags
                if($descend) {
                    $descended_tags = $this->getTagCloudTags($r['tag'], false);
                    foreach($descended_tags AS $dtag => $value) {
                        $descended_tags[$dtag] = $value / 2;
                    }
                    $tags = array_merge($tags, $descended_tags);
                }
            }
        }
        unset($tags["$tag"]);
        return $tags;
    }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: plugin freetag, related tags bug (<)

Post by garvinhicking »

Hi!

Good catch! Thanks!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin freetag, related tags bug (<)

Post by Timbalu »

ops, thats even better ;-)

Code: Select all

        unset($tags["$tag"]);
        return $tags;
        }
    }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply