Closed (duplicate)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.x-dev
Component:
Plugins system
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
15 Feb 2010 at 19:19 UTC
Updated:
31 Dec 2010 at 20:41 UTC
At the moment its possible to accidently request and try to instantiate an abstract class from ctools.
Common code block I've run into:
$foo = array();
foreach($list as $plugin) {
$c = ctools_plugin_load_class('module', 'type', $plugin, 'handler');
if ($c) {
$foo[] = new $c();
}
}
If you where provided an item in that list that points to an abstract class this could cause a fatal error on your page.
With the attached patch we provide some helpful filtering that helps avoid this.
| Comment | File | Size | Author |
|---|---|---|---|
| ctools_plugin_class_filter_abstract.patch | 1.96 KB | neclimdul |
Comments
Comment #1
neclimdulI should note, this patch was built on top of patches #703040: Ctools object plugins can be broken when plugin caching is enabled. and #711664: Make global plugins definition hooks optional but separate so its easier to review.
edit: fix issue id
Comment #2
merlinofchaos commentedLooks like I committed this quite some time ago already.
Comment #3
merlinofchaos commentedAll of the 'to be ported' patches got merged in during the porting sprint in September.