Skip to:
Content

Opened 4 years ago

Closed 4 years ago

#5671 closed defect (bug) (fixed)

Unable to register class method as template stack location

Reported by: johnjamesjacoby Owned by: johnjamesjacoby
Milestone: 2.1 Priority: high
Severity: major Version: 1.7
Component: Appearance - Template Pack Keywords: commit
Cc:

Description

In bp_register_template_stack() the function_exists() check is preventing class methods from being used as a callback.

Change History (6)

#1 @johnjamesjacoby
4 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 8461:

In bp_register_template_stack() wrap function_exists() check with is_array() check. Allows class methods to be used as a callback for adding new template stack locations. Fixes #5671.

#2 @johnjamesjacoby
4 years ago

In 8462:

In bp_deregister_template_stack() wrap function_exists() check with is_array() check. Allows class methods to be removed from template stack locations. See #5671.

#3 follow-up: @boonebgorges
4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Best is probably to use is_callable(). Then indiscriminate arrays won't be allowed through, and you only have to do a single check for all PHP callable types.

#4 @johnjamesjacoby
4 years ago

In 8463:

Replace function_exists() checks with is_callable() in template stack functions. Props boonebgorges. See: #5671

#5 in reply to: ↑ 3 @johnjamesjacoby
4 years ago

Replying to boonebgorges:

Best is probably to use is_callable(). Then indiscriminate arrays won't be allowed through, and you only have to do a single check for all PHP callable types.

Duh. Thanks for this. Much nicer.

#6 @DJPaul
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.