Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 8 years ago

#6391 closed defect (bug) (fixed)

when i go to view a profile or anything that has to do with buddy press. this appears: <b>Warning</b>: strstr(): Empty needle in

Reported by: scarrano1's profile scarrano1 Owned by: tw2113's profile tw2113
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.2.3
Component: Core Keywords: has-patch commit
Cc:

Description

when i go to view a profile or anything that has to do with buddy press. this appears:
<b>Warning</b>: strstr(): Empty needle in <b>/home3/filmfilm/public_html/wp-content/plugins/buddypress/bp-core/bp-core-filters.php</b> on line <b>641</b>

this appears as the name of my tab. as the <title> when i go to view source. what does this mean and how do i get rid of it?

Attachments (1)

6391-empty-blogname-check.diff (744 bytes) - added by tw2113 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
8 years ago

  • Component changed from Component - Any/All to Core

#2 @tw2113
8 years ago

Part of the bp_modify_page_title() function. The only way I'm seeing this be a potential issue is via either a filter on the bloginfo hook or if a user has no set the blogname option in their General settings.

Regardless of method to provide an empty string, may not be a bad idea to change

$title_tag_compatibility = (bool) ( ! empty( $_wp_theme_features['title-tag'] ) || strstr( $title, $blogname ) );

to

$title_tag_compatibility = (bool) ( ! empty( $_wp_theme_features['title-tag'] ) || ( ! empty( $blogname ) && strstr( $title, $blogname ) ) );

Will diff it up when I can fetch a fresh copy of master.

#3 @tw2113
8 years ago

Tests pass :)

#4 @tw2113
8 years ago

  • Keywords has-patch added
  • Priority changed from high to normal

#5 @DJPaul
8 years ago

  • Keywords commit added

Looks good!

Note: for next time, we could use something like $blogname && strstr( $title, $blogname ) here instead of ! empty().

empty is good use when accessing array properties (maybe class properties, too) that may not be set or just empty, because it basically does a isset($value['what']) && $value['what'] != null (I don't know how to find language constructs in the PHP C++ source, so I can't back this up, but this is what my mental understanding of the empty construct has always done). While in this case there's no real difference, I prefer the more succinct approach.

#6 @DJPaul
8 years ago

  • Milestone changed from BuddyPress.org Sites to 2.7

#7 @DJPaul
8 years ago

  • Owner set to tw2113
  • Status changed from new to assigned

#8 @tw2113
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 11010:

Prevent PHP warning regarding possible empty needle variables for bp_modify_page_title() function. Fixes #6391.

Note: See TracTickets for help on using tickets.