ZF-7918: Zend_Filter::filterStatic() include file not found warnings: namespaces



I'm having problems using namespaces. I wrote a few of my own filters and put them in LSS/Filter (which is correctly on the include path).

$type = 'Alpha'; // a builtin ZF filter
Zend_Filter::filterStatic( $value, $type, $params, array( 'LSS_Filter', 'Zend_Filter' ) );

results in

Warning: Zend_Loader::include(LSS/Filter/Alpha.php) [function.Zend-Loader-include]: failed to open stream: No such file or directory in 
/Users/stevep/Documents/lss/projects/library/Zend/Loader.php on line 83

It seems that whatever namespace goes first will find its filters with no problems, second or subsequent namespaces result in a warning message even though it correctly loads the builtin Zend/Filter/Alpha.php The desired behaviour is that no warning message would be generated.

The problem can be easily fixed by putting an @ in front of the include statement in line 83 of Zend/Loader.php because in Zend/Filter.php the class loader blindly tries namespaces in order: (snippet below from that file, line 172ff)

if (!class_exists($className)) {
  try {
  } catch (Zend_Exception $ze) {

But the include warning is probably useful in other contexts? Maybe using Zend_Loader_Autoloader here would be a more permanent fix?


Fixed formatting.

Fixed with r18379

Zend_Loader_Autoloader::autoload() creates an instance of the autoloader internally, which appends itself to the spl_autoload_register() stack if not yet done before, for example when people have their own autoloaders this could potentially be a problem.

Is this a desired side-effect?

thomas, in regard to our discussion i think plugin loader is really the correct way to solve this problem.

Fixed with r18424