Details
-
Type:
Patch
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not an Issue
-
Affects Version/s: None
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Filter
-
Labels:None
Description
I get fatal error "Cannot redeclare class Zend_Filter_StringTrim" on this code:
Zend_Filter::addDefaultNamespaces(array('MyNamespace'));
Zend_Filter::filterStatic(' foo ', 'StringTrim'));
I use autoloader in standard way:
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
There is some problem with custom namespace. It was solved by changing this code in Zend/Filter.php[172]:
if (!class_exists($className)) {
to call with disabled autoload:
if (!class_exists($className, false)) {
But I'm not sure if it is good solution.
Not an issue
Changing the component, so classes would no longer be loaded would not be a good idea.
The reason seems that you have declared the same classname within 2 different files. This, of course, throws an exception.
It is also to note that the code line you gave and the release you gave do not conform... line 172: $className = $namespace . '_' . ucfirst($classBaseName); would NEVER throw an exception.
Feel free to reopen the issue when you have additional informations.