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

Fixed resolveDynamicClass when $class is empty

xfrocks

Well-known member
#1
Fatal error will occur if both of these happens:
  • Some add-on (#1) use responseView without a view class
  • Some other add-on (#2) use load_class_view to extend the empty view class (I know it doesn't make sense but it's possible to do that)
Explain:

For views, when $class is missing, $fakeNeeded will be set to true. Add-on #2 wants to extend the view, this line will run...

PHP:
eval('class '. $class .' extends '. $fakeBase .' {}');
Because $class is empty, the eval will failed because of syntax error. Leading to further errors down the line because $createClass is also empty.
 
Last edited:

Mike

XenForo developer
Staff member
#2
I've changed this such that the dynamic class resolution system doesn't run if $class is empty. It really doesn't make sense. The system is for extending classes based on specific ones being loaded, so doing anything to an empty class is meaningless.
 

xfrocks

Well-known member
#3
I've changed this such that the dynamic class resolution system doesn't run if $class is empty. It really doesn't make sense. The system is for extending classes based on specific ones being loaded, so doing anything to an empty class is meaningless.
Thank you.

Yeah, it doesn't make much sense but in this particular case I need the view object to reuse it later.