Support » Plugin: Lightbox Plus Colorbox » Undefined Variable Warnings

  • I’m running LBP version 2.6 on WP 3.5.1 and it was spitting out some annoying warnings about undefined variables:

    Notice: Undefined variable: theOptions in /path/to/wp/wp-content/plugins/lightbox-plus/lightboxplus.php on line 260
    Notice: Undefined variable: theOptions in /path/to/wp/wp-content/plugins/lightbox-plus/lightboxplus.php on line 261
    Notice: Undefined variable: lightboxPlusOptions in /path/to/wp/wp-content/plugins/lightbox-plus/lightboxplus.php on line 203

    To fix this, I added the following on line 203:

    $lightboxPlusOptions = ( isset( $lightboxPlusOptions ) ) ? $lightboxPlusOptions : '';

    and this on line 255:

    $theOptions = ( isset( $theOptions ) ) ? $theOptions : '';

    Basically, if the variable is set, set the value to itself, otherwise, set the value to null so PHP will shut up about it. I’m sure there’s a more elegant way to handle this, but this got the problem solved and doesn’t affect the rest of the code… There is a chance that if I’m feeling ambitious later, I’ll go back and take a look later to find a less hackish fix. 🙂

    Thanks for all your hard work!

  • The topic ‘Undefined Variable Warnings’ is closed to new replies.