Support » Plugin: BuddyPress Sticker » Notice: Only variables should be passed by reference

  • Hello,

    I have debug mode turned on to ensure best programming practices. I noticed the following output :

    Notice: Only variables should be passed by reference in /var/www/vhosts/woowclover.com/old.woowclover.com/wp-content/plugins/buddypress-sticker/bp-sticker.php on line 115

    This poses 2 issues:

    1. it sends that output 134 times PER POST. This means that this function gets called arguably much more than it needs to be. Can’t the product of this function be cached in the previous function ? Can’t it be outputted as a separate html element that is afterwards referenced to ?

    2. It seems that the line in question :
    $file_type = strtolower(end(explode(‘.’, $file)));

    could be re-written as:
    $placeholder = explode(‘.’, $file);
    $placeholder = end($placeholder);
    $file_type = strtolower($placeholder);
    which accomplishes both goals of having the code more readable and avoiding the warning.

    Perhaps you guys could implement these suggestions.

    Thank you,
    Adrian.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Notice: Only variables should be passed by reference’ is closed to new replies.