[wp-trac] [WordPress Trac] #25160: Unnecessarily passing $this by reference in core
WordPress Trac
noreply at wordpress.org
Tue Sep 17 12:54:05 UTC 2013
#25160: Unnecessarily passing $this by reference in core
-------------------------------------------------+-------------------------
Reporter: jdgrimes | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.7
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-codex |
dev-feedback |
-------------------------------------------------+-------------------------
Changes (by jdgrimes):
* keywords: has-patch needs-testing needs-codex => has-patch needs-testing
needs-codex dev-feedback
Comment:
The second part of this patch covers `do_*_ref_array()` calls. The problem
with my proposed patch for that is that functions hooking into these
actions/filters may be explicitly expecting references to be passed to
them, not values. There is even at least one instance of this in core
itself. It would be no problem, except that this results in a PHP warning
- which unlike notices won't be silenced automatically. So as much as I
would like to see these converted to regular `do_action()` and
`apply_filters()` because they are unnecessary and confusing, we probably
can't just rip them out. We'd have to deprecate something.
Ideally, we would catch the errors and then give a deprecated notice when
`WP_DEBUG` is on. Not deprecating the hooks themselves, just the passing
of the argument(s) by reference.
Is that worth it? Any thoughts?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25160#comment:17>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list