Issues

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

Issue Type: Bug Created: 2009-09-21T15:03:48.000+0000 Last Updated: 2009-09-27T00:45:16.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Steve Pavarno (pavarnos) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: Attachments:

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).

<pre class="highlight">
$type = 'Alpha'; // a builtin ZF filter
Zend_Filter::filterStatic( $value, $type, $params, array( 'LSS_Filter', 'Zend_Filter' ) );

results in

<pre class="highlight">
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)

<pre class="highlight">
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?

Comments

Posted by Till Klampaeckel (till) on 2009-09-22T13:43:22.000+0000

Fixed formatting.

Posted by Thomas Weidner (thomas) on 2009-09-22T14:22:35.000+0000

Fixed with r18379

Posted by Benjamin Eberlei (beberlei) on 2009-09-23T10:36:06.000+0000

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?

Posted by Benjamin Eberlei (beberlei) on 2009-09-23T23:26:43.000+0000

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

Posted by Thomas Weidner (thomas) on 2009-09-27T00:45:12.000+0000

Fixed with r18424

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts