Zend Framework

Zend_Filter::filterStatic() and autoload error

Details

  • Type: Patch Patch
  • Status: Resolved Resolved
  • Priority: Major 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.

Activity

Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: