[wp-trac] [WordPress Trac] #29803: Silent failure when wp_embed_register_handler() has a non-public callback
WordPress Trac
noreply at wordpress.org
Fri Oct 10 20:38:32 UTC 2014
#29803: Silent failure when wp_embed_register_handler() has a non-public callback
-------------------------------------------+------------------------------
Reporter: paulschreiber | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: dev-feedback needs-unit-tests | Focuses:
-------------------------------------------+------------------------------
Changes (by leewillis77):
* keywords: => dev-feedback needs-unit-tests
Comment:
Actually, add_action() '''doesn't''' check for the callability of the
function - hence PHP throwing the warning.
The embed code specifically checks that the callback is callable, and
doesn't try to call it if not, so no error is thrown. I'm pretty sure we
wouldn't want to remove that check, and have the embed code start throwing
warnings where it didn't before.
It's possible we could add a check when the handler is registered -
however, just because the function isn't callable at that point doesn't
mean it won't be at the time it's needed. Perhaps making
wp_embed_register_handler() return false if the callback isn't callable
but registering it anyway, and relying on the caller to notice the return
value that would be acceptable (Patch attached), not 100% sure that
"smells" right though?
If someone's happy that's an acceptable approach I'll expand the patch to
include tests.
We could also consider the fact that do_action() throws a warning to be
the bug and fix that up
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29803#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list