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

XenForo_Application::getOptions()->get() returns.. null?

Discussion in 'XenForo Development Discussions' started by tyteen4a03, Apr 5, 2014.

  1. tyteen4a03

    tyteen4a03 Well-Known Member

    It's 2:30am so I have no idea what I am missing.

    Since I attempted to add caching, my addon broke. When I tried to track down the cause, I came to this line, and I found out that the value for get(anything) is null.

    Did I break XF?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    I'm not sure what the use case for XenForo_Application::getOptions is, but I have noticed the same behaviour.

    XenForo_Application::get('options')->option_id works globally.
     
  3. tyteen4a03

    tyteen4a03 Well-Known Member

    Which is strange because getOptions is just a shorthand for get('options'). Even xF use getOptions internally.
     
    Last edited: Apr 5, 2014
  4. Chris D

    Chris D XenForo Developer Staff Member

    Yeah I thought it was odd at the time.

    But I switched it back to what I normally use and it started working.

    Does it make any difference if you use:

    XenForo_Application::getOptions()->yourOptionId;

    or

    XenForo_Application::get('options')->yourOptionId;

    ?
     
  5. tyteen4a03

    tyteen4a03 Well-Known Member

    No difference. Still null. However this time boardActive do return 1.

    I don't understand this because as you can see in the XML file I exported, 3ps_cmfu_useCache does exist...
     
  6. Milano

    Milano Well-Known Member

    It's a typo. Your option_id in XML is 3ps_cufm_useCache not 3ps_cmfu_useCache
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    Actually the XML file you're currently hosting on repo doesn't have that option...
     
  8. Chris D

    Chris D XenForo Developer Staff Member

    Yep :)

    Code:
    <option option_id="3ps_cufm_useCache" edit_format="onoff" data_type="boolean" can_backup="1">
    <default_value>1</default_value>
    <edit_format_params></edit_format_params>
    <sub_options></sub_options>
    <relation group_id="3ps_cmfu" display_order="2"/>
    </option>
     
  9. tyteen4a03

    tyteen4a03 Well-Known Member

    :oops:
    Note to self: Don't work after midnight.
     
    euantor and Chris D like this.
  10. Chris D

    Chris D XenForo Developer Staff Member

    Or help someone who is working after midnight after midnight :D
     
    tyteen4a03 likes this.
  11. Adrian Schneider

    Adrian Schneider Active Member

    This is why error reporting exists... :(

    (directed at XF, not you guys)
     

Share This Page