Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#52784 closed enhancement (duplicate)

Granularize and catch error called on line 292 of wp-includes/class-wp-hook.php

Reported by: laughter-on-water's profile Laughter On Water Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7
Component: Plugins Keywords:
Focuses: coding-standards Cc:

Description (last modified by SergeyBiryukov)

Currently, when you're designing a theme or plugin, any malformed functions or the malformed hooks that activate them can throw this error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name in /home/user_name/user.web.site/wp-includes/class-wp-hook.php on line 292

Core is not the cause of the error. My in-development plugin is.

It would be more helpful if this error were caught in such a way that theme and plugin designers could be told in the debug.log exactly which line in theme's or plugin's function.php is causing the error.

Change History (3)

#1 @jrf
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing as duplicate of #51894 which was marked "wont-fix".

Invalid function names being passed to hooks is a developer error.

There are tools, like Xdebug, and plugins, like Debug bar actions and filters, available to help you trace back the source of the error.

Slowing down one of the most used functions in Core to make allowances for something which is an undisputed developer error and should never make it into production, is not the way to go.

#2 @SergeyBiryukov
4 years ago

  • Component changed from General to Plugins
  • Keywords needs-design needs-docs removed

#3 @SergeyBiryukov
4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.