1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not a Bug Redeclaration of Proxy Class problem

Discussion in 'Resolved Bug Reports' started by guiltar, Feb 7, 2012.

  1. guiltar

    guiltar Well-Known Member

    When I try to extend multiple controllers by one class Application declares this class twice and gives error:
    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:
    eval('class ' $proxyClass ' extends ' $createClass ' {}');
    if(!class_exists($proxyClass0)) // 0 - without autoload
    '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.
  2. Mike

    Mike XenForo Developer Staff Member

    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.
  3. guiltar

    guiltar Well-Known Member

    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.

Share This Page