Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
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?
Fixed formatting.