simonfrey / mastodon_wordpress_autopost

A Wordpress Plugin that automatically posts your new articles to Mastodon
https://wordpress.org/plugins/autopost-to-mastodon/
GNU General Public License v2.0
33 stars 20 forks source link

post tags array safety checks #54

Open kyrahabattoir opened 3 years ago

kyrahabattoir commented 3 years ago

Just close this if i'm wrong but...

at https://github.com/simonfrey/mastodon_wordpress_autopost/blob/c24f4cef9582d676857690e1988551953afae713/autopost-to-mastodon/trunk/mastodon_autopost.php#L544

shouldn't

        $post_tags = get_the_tags($id);
        if (sizeof($post_tags) > 0) {
            if ($post_tags) {

be instead

        $post_tags = get_the_tags($id);
        if ($post_tags) {
            if (sizeof($post_tags) > 0) {

That is, check if post_tags is not null and THEN check its length rather than the other way around?

simonfrey commented 3 years ago

Did you test it how it behaves with you change? If not please do so and then we know best if it still works as intended :D