[buddypress-trac] [BuddyPress Trac] #7149: Templates: locating empty array of template(s) errors undefined variable
buddypress-trac
noreply at wordpress.org
Fri Jul 29 09:45:23 UTC 2016
#7149: Templates: locating empty array of template(s) errors undefined variable
-----------------------------------------+------------------
Reporter: Offereins | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.7
Component: Core | Version:
Severity: normal | Resolution:
Keywords: has-patch reporter-feedback |
-----------------------------------------+------------------
Changes (by DJPaul):
* keywords: has-patch => has-patch reporter-feedback
* milestone: Awaiting Review => 2.7
Comment:
Easily re-produced:
> wp> bp_locate_template(array())
> PHP Notice: Undefined variable: template_name in
/srv/www/buddypress.dev/src/wp-content/plugins/buddypress/src/bp-core/bp-
core-template-loader.php on line 138
@Offereins Thanks for the report and patch. How do you feel about making
this function return an empty string if a template can't be found? If so,
let's put a `since` tag on the PHPDoc explaining the return type change.
I know it returns a bool already, but I think that's just bad function
design. An empty string is a false-y value, so it'd probably won't break
anything unless someone's doing a type-strict check on the output of
`bp_locate_template`. We/you would need to check the instances of this
function in BuddyPress core to check if this breaks anything.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7149#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list