google-code-export / zfdebug

Automatically exported from code.google.com/p/zfdebug
Other
1 stars 1 forks source link

Unable to register namespaced custom plugin via Zend Config #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. zfdebug.plugins.ets\debug\zfdebug\plugin\Doctrine      = 1
2.
3.

What is the expected output? What do you see instead?

Getting this error:
ZFDebug: Invalid plugin name ... (Debug.php line 258)

What version of the product are you using? On what operating system?

Version 1.5

Please provide any additional information below.

See attachment for the fix.

Original issue reported on code.google.com by wilmo...@gmail.com on 15 Aug 2010 at 8:56

Attachments:

GoogleCodeExporter commented 9 years ago
There are only two changes:

1. change this regex: 
   preg_match('~^[\w]+$~D', $plugin)
to preg_match('~^[\\\\\w]+$~D', $plugin)
NOTE: this allows you to load a namespaced plugin like: 
\debug\zfdebug\plugin\Doctrine

2. Change this line:
   require_once str_replace('_', DIRECTORY_SEPARATOR, $pluginClass) . '.php';
to if (! class_exists($pluginClass, true)) {
       require_once str_replace('_', DIRECTORY_SEPARATOR, $pluginClass) . '.php';
   }
NOTE: this allows you to autoload your custom plugin.

Original comment by wilmo...@gmail.com on 15 Aug 2010 at 9:07

GoogleCodeExporter commented 9 years ago
Being able to use namespace plugin classes is a must. The suggested changes 
work for me and I like to see them in next release.

Original comment by michael....@gmail.com on 19 Oct 2010 at 11:43