1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not a Bug Unnecessary empty() function call in BbCode Base.php

Discussion in 'Resolved Bug Reports' started by thedude, Nov 20, 2013.

  1. thedude

    thedude Well-Known Member

    Not so much a bug, but just a code cleanup issue.

    In library/XenForo/BbCode/Formatter/Base.php, line 1054

    $noFollow = (empty($rendererStates['noFollowDefault']) ? '' ' rel="nofollow"');
    $rendererStates['noFollowDefault'] is either true/false, so the empty() function surrounding is not needed
  2. cclaerhout

    cclaerhout Well-Known Member

    The function empty() check if the given variable is true or false but is also used like an isset(). If the key noFollowDefault is not set, this will prevent a php error.
    thedude and Alluidh like this.
  3. Mike

    Mike XenForo Developer Staff Member

    Yes, empty is perfectly valid even when it exists and basically the same as !isset($x) OR !$x.
    thedude likes this.

Share This Page