Filters don't check that the function is callable
|Reported by:||aaroncampbell||Owned by:|
This is a problem that I found in Shopp. Basically, they used add_filter('redirect_canonical', 'canonical_home'); when it should have been add_filter('redirect_canonical', array( $this, 'canonical_home' ));, so the function added to redirect_canonical didn't actually exist. However, it's still called and NULL is always returned, so the canonical redirects completely stopped working.
It seems like we should add an is_callable test to either apply_filters or add_filter. I'd prefer to see it on apply_filters simply because more filters are added than are actually run.
As Nacin pointed out, this is additional execution and our filters need to stay lean and mean. Still, I see both sides to this so I thought I'd try to get some feedback from other devs.
Change History (8)
comment:6 follow-up: ↓ 7 aaroncampbell — 3 years ago
- Keywords dev-feedback removed
- Resolution set to wontfix
- Status changed from new to closed