Zend Framework

Zend_Filter::filterStatic() include file not found warnings: namespaces

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.2
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Filter
  • Labels:
    None

Description

Hi

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 {
    Zend_Loader::loadClass($className);
  } catch (Zend_Exception $ze) {
    continue;
  }
}

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

Activity

Hide
Till Klampaeckel added a comment -

Fixed formatting.

Show
Till Klampaeckel added a comment - Fixed formatting.
Hide
Thomas Weidner added a comment -

Fixed with r18379

Show
Thomas Weidner added a comment - Fixed with r18379
Hide
Benjamin Eberlei added a comment -

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?

Show
Benjamin Eberlei added a comment - 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?
Hide
Benjamin Eberlei added a comment -

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

Show
Benjamin Eberlei added a comment - thomas, in regard to our discussion i think plugin loader is really the correct way to solve this problem.
Hide
Thomas Weidner added a comment -

Fixed with r18424

Show
Thomas Weidner added a comment - Fixed with r18424

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: