mastodon_wordpress_autopost icon indicating copy to clipboard operation
mastodon_wordpress_autopost copied to clipboard

post tags array safety checks

Open kyrahabattoir opened this issue 4 years ago • 1 comments

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?

kyrahabattoir avatar Feb 11 '21 20:02 kyrahabattoir

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

simonfrey avatar Feb 16 '21 07:02 simonfrey