Issues

ZF-8525: Zend_Filter::filterStatic() fails with non-Zend namespaces.

Issue Type: Bug Created: 2009-12-11T12:22:19.000+0000 Last Updated: 2009-12-11T13:33:29.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Jeffrey Sambells (jeffrey) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: Attachments:

Description

For example, we have some of our own filters in a "Webready" class structure so we have:

Zend_Filter::addDefaultNamespaces( array('Webready_Filter', 'Zend_Filter') );

but this causes an error if the filter only exists in the zend library:

$filtered = Zend_Filter::filterStatic( 'testTest', 'Word_CamelCaseToUnderscore' ) );

ERROR: include(Webready/Filter/Word/CamelCaseToUnderscore.php): failed to open stream: No such file or directory Zend/Loader.php:83 Zend/Loader.php:83 Zend/Loader/Autoloader.php:474 Zend/Loader/Autoloader.php:130 Zend/Filter.php:172

The above error is "valid" since it's true that the file doesn't exist in our library but it does in Zend.

The problem is two fold. First Zend_Filter::filterStatic has:

if (!class_exists($className)) { try { Zend_Loader::loadClass($className); } catch (Zend_Exception $ze) { continue; } }

The class_exists needs a false as the second argument otherwise class exists invokes the autoloader.

Second, if you add false, the loadClass still attempts to load the file without checking if it exists first:

Error: include(Webready/Filter/Word/CamelCaseToUnderscore.php): failed to open stream: No such file or directory Zend/Loader.php:83 Zend/Loader.php:83 Zend/Filter.php:174

Comments

Posted by Thomas Weidner (thomas) on 2009-12-11T13:33:29.000+0000

Duplication of ZF-7918

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