Not a bug Redeclaration of Proxy Class problem

guiltar

Well-known member
When I try to extend multiple controllers by one class Application declares this class twice and gives error:
Code:
Fatal error: Cannot redeclare class XFCP_Social_ControllerPublic_Widgets in .../Application.php(397) : eval()'d code on line 1
The problem can be easily solved replacing the line 397:
PHP:
eval('class ' . $proxyClass . ' extends ' . $createClass . ' {}');
by
PHP:
if(!class_exists($proxyClass, 0)) // 0 - without autoload
{
   eval('class ' . $proxyClass . ' extends ' . $createClass . ' {}');
}
Please, add some condition to check if class if declared already. Extending multiple classes by one is very important thing. Especially for widgets since they actively use controller methods but may do same things on different controllers.
 
When I try to extend multiple controllers by one class Application declares this class twice and gives error:
You simply can't do this. Even if we did the protection, it wouldn't work correctly.

You would need to make some sort of shim for each controller or approach it differently.
 
Thanks it really works not correctly. But is there any way to access Controller and ControllerResponse same time
in order to use and change viewParams by controller methods?
It probably can be done using evals for declaring different named conrollers but it's not nice way.
 
Top Bottom