• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 4.x Series
    • Bug
    • Template Errors after VW is installed

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: Template Errors after VW is installed

    • Issue Tools
      • View Changes
    1. issueid=5586 January 7, 2019 7:14 PM
      badgernz badgernz is offline
      New Member
      Template Errors after VW is installed
      Template Errors after VW is installed

      Hello pegasus,

      After my previous issue got resolved and we got VW successfully installed we now get the following Template errors.

      Code:
      ErrorException: Template error: array_map(): Expected parameter 2 to be an array, null given src/XF/Mvc/Entity/ValueFormatter.php:71
      Generated by: Unknown account Jan 7, 2019 at 10:28 PM
      Stack trace
      #0 [internal function]: XF\Template\Templater->handleTemplateError(2, 'array_map(): Ex...', 's...', 71, Array)
      #1 src/XF/Mvc/Entity/ValueFormatter.php(71): array_map('intval', NULL)
      #2 src/XF/Mvc/Entity/Manager.php(731): XF\Mvc\Entity\ValueFormatter->decodeValueFromSourceExtended(65554, NULL, Array)
      #3 src/XF/Mvc/Entity/Entity.php(213): XF\Mvc\Entity\Manager->decodeValueFromSourceExtended(65554, Array, Array)
      #4 src/XF/Mvc/Entity/Entity.php(165): XF\Mvc\Entity\Entity->getValue('ncms_groups')
      #5 src/XF/Mvc/Entity/Entity.php(497): XF\Mvc\Entity\Entity->get('ncms_groups')
      #6 src/addons/vw/vw/_core/model/user/xf2.php(201): XF\Mvc\Entity\Entity->toArray()
      #7 src/addons/vw/vw/_core/model/user/xf2.php(343): vw_User_Model_XF2->get()
      #8 src/addons/vw/vw/_core/view/global/vw.php(553): vw_User_Model_XF2->is_admin()
      #9 src/addons/vw/vw/_core/view/global/vw.php(197): vw_Global_View->add_script('vault/resources...')
      #10 src/addons/vw/vw/_core/instance/parser/renderer/xf2.php(810): vw_Global_View->add_js_trigger('sort-table', 'vw_Sort_Table', 'sorttable.js')
      #11 src/addons/vw/vw/_core/instance/parser/renderer/xf2.php(283): vw_Parser_Renderer_Instance_XF2->getWikiTagDefinitions(Array)
      #12 src/addons/vw/vw/XF/BbCode/Renderer/Html.php(99): vw_Parser_Renderer_Instance_XF2->setupTagList(Array)
      #13 src/addons/vw/vw/XF/BbCode/Renderer/Html.php(92): vw\vw\XF\BbCode\Renderer\Html->vwParentRender('Posting random ...', Object(vw\vw\XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
      #14 src/XF/SubContainer/BbCode.php(216): vw\vw\XF\BbCode\Renderer\Html->render('Posting random ...', Object(vw\vw\XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
      #15 src/XF/Template/Templater.php(1864): XF\SubContainer\BbCode->render('Posting random ...', 'html', 'ewr_porta_artic...', Object(EWR\Atendo\Entity\Post), Array)
      #16 [internal function]: XF\Template\Templater->fnBbCode(Object(vw\vw\XF\Template\Templater), false, 'Posting random ...', 'ewr_porta_artic...', Object(EWR\Atendo\Entity\Post))
      #17 src/XF/Template/Templater.php(881): call_user_func_array(Array, Array)
      #18 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_macros.php(253): XF\Template\Templater->fn('bb_code', Array, false)
      #19 src/XF/Template/Templater.php(663): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array, Array)
      #20 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_macros.php(82): XF\Template\Templater->callMacro('EWRporta_articl...', 'article_block', Array, Array)
      #21 src/XF/Template/Templater.php(663): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array, Array)
      #22 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_index.php(46): XF\Template\Templater->callMacro('EWRporta_articl...', 'articles_block', Array, Array)
      #23 src/XF/Template/Templater.php(1250): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array)
      #24 src/addons/vw/vw/XF/Template/Templater.php(621): XF\Template\Templater->renderTemplate('EWRporta_articl...', Array, true)
      #25 src/XF/Template/Template.php(24): vw\vw\XF\Template\Templater->renderTemplate('public:EWRporta...', Array)
      #26 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
      #27 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('EWR\\Porta:Artic...', 'public:EWRporta...', Array)
      #28 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
      #29 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
      #30 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
      #31 src/XF.php(333): XF\App->run()
      #32 index.php(13): XF::runApp('XF\\Pub\\App')
      #33 {main}
      Request state
      array(4) {
        ["url"] => string(1) "/"
        ["referrer"] => bool(false)
        ["_GET"] => array(0) {
        }
        ["_POST"] => array(0) {
        }
      }
      Code:
      ErrorException: Template error: explode() expects parameter 2 to be string, array given src/XF/Mvc/Entity/ValueFormatter.php:42
      Generated by: Unknown account Jan 7, 2019 at 10:28 PM
      Stack trace
      #0 [internal function]: XF\Template\Templater->handleTemplateError(2, 'explode() expec...', 's...', 42, Array)
      #1 src/XF/Mvc/Entity/ValueFormatter.php(42): explode(',', Array)
      #2 src/XF/Mvc/Entity/ValueFormatter.php(59): XF\Mvc\Entity\ValueFormatter->decodeValueFromSource(65554, Array)
      #3 src/XF/Mvc/Entity/Manager.php(731): XF\Mvc\Entity\ValueFormatter->decodeValueFromSourceExtended(65554, Array, Array)
      #4 src/XF/Mvc/Entity/Entity.php(213): XF\Mvc\Entity\Manager->decodeValueFromSourceExtended(65554, Array, Array)
      #5 src/XF/Mvc/Entity/Entity.php(165): XF\Mvc\Entity\Entity->getValue('ncms_groups')
      #6 src/XF/Mvc/Entity/Entity.php(497): XF\Mvc\Entity\Entity->get('ncms_groups')
      #7 src/addons/vw/vw/_core/model/user/xf2.php(201): XF\Mvc\Entity\Entity->toArray()
      #8 src/addons/vw/vw/_core/model/user/xf2.php(343): vw_User_Model_XF2->get()
      #9 src/addons/vw/vw/_core/view/global/vw.php(553): vw_User_Model_XF2->is_admin()
      #10 src/addons/vw/vw/_core/view/global/vw.php(197): vw_Global_View->add_script('vault/resources...')
      #11 src/addons/vw/vw/_core/instance/parser/renderer/xf2.php(810): vw_Global_View->add_js_trigger('sort-table', 'vw_Sort_Table', 'sorttable.js')
      #12 src/addons/vw/vw/_core/instance/parser/renderer/xf2.php(283): vw_Parser_Renderer_Instance_XF2->getWikiTagDefinitions(Array)
      #13 src/addons/vw/vw/XF/BbCode/Renderer/Html.php(99): vw_Parser_Renderer_Instance_XF2->setupTagList(Array)
      #14 src/addons/vw/vw/XF/BbCode/Renderer/Html.php(92): vw\vw\XF\BbCode\Renderer\Html->vwParentRender('Posting random ...', Object(vw\vw\XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
      #15 src/XF/SubContainer/BbCode.php(216): vw\vw\XF\BbCode\Renderer\Html->render('Posting random ...', Object(vw\vw\XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
      #16 src/XF/Template/Templater.php(1864): XF\SubContainer\BbCode->render('Posting random ...', 'html', 'ewr_porta_artic...', Object(EWR\Atendo\Entity\Post), Array)
      #17 [internal function]: XF\Template\Templater->fnBbCode(Object(vw\vw\XF\Template\Templater), false, 'Posting random ...', 'ewr_porta_artic...', Object(EWR\Atendo\Entity\Post))
      #18 src/XF/Template/Templater.php(881): call_user_func_array(Array, Array)
      #19 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_macros.php(253): XF\Template\Templater->fn('bb_code', Array, false)
      #20 src/XF/Template/Templater.php(663): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array, Array)
      #21 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_macros.php(82): XF\Template\Templater->callMacro('EWRporta_articl...', 'article_block', Array, Array)
      #22 src/XF/Template/Templater.php(663): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array, Array)
      #23 internal_data/code_cache/templates/l1/s4/public/EWRporta_articles_index.php(46): XF\Template\Templater->callMacro('EWRporta_articl...', 'articles_block', Array, Array)
      #24 src/XF/Template/Templater.php(1250): XF\Template\Templater->{closure}(Object(vw\vw\XF\Template\Templater), Array)
      #25 src/addons/vw/vw/XF/Template/Templater.php(621): XF\Template\Templater->renderTemplate('EWRporta_articl...', Array, true)
      #26 src/XF/Template/Template.php(24): vw\vw\XF\Template\Templater->renderTemplate('public:EWRporta...', Array)
      #27 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
      #28 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('EWR\\Porta:Artic...', 'public:EWRporta...', Array)
      #29 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
      #30 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
      #31 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
      #32 src/XF.php(333): XF\App->run()
      #33 index.php(13): XF::runApp('XF\\Pub\\App')
      #34 {main}
      Request state
      array(4) {
        ["url"] => string(1) "/"
        ["referrer"] => bool(false)
        ["_GET"] => array(0) {
        }
        ["_POST"] => array(0) {
        }
      }
      This shows when you try to view the forums, which also outputs an error on the page of:

      Code:
      An unexpected error occurred. Please try again later.
      Code:
      ErrorException: [E_WARNING] explode() expects parameter 2 to be string, array given src/XF/Mvc/Entity/ValueFormatter.php:42
      Generated by: Unknown account Jan 7, 2019 at 10:28 PM
      Stack trace
      #0 [internal function]: XF::handlePhpError(2, '[E_WARNING] exp...', 's...', 42, Array)
      #1 src/XF/Mvc/Entity/ValueFormatter.php(42): explode(',', Array)
      #2 src/XF/Mvc/Entity/ValueFormatter.php(59): XF\Mvc\Entity\ValueFormatter->decodeValueFromSource(65554, Array)
      #3 src/XF/Mvc/Entity/Manager.php(731): XF\Mvc\Entity\ValueFormatter->decodeValueFromSourceExtended(65554, Array, Array)
      #4 src/XF/Mvc/Entity/Entity.php(213): XF\Mvc\Entity\Manager->decodeValueFromSourceExtended(65554, Array, Array)
      #5 src/XF/Mvc/Entity/Entity.php(165): XF\Mvc\Entity\Entity->getValue('ncms_groups')
      #6 src/XF/Mvc/Entity/Entity.php(497): XF\Mvc\Entity\Entity->get('ncms_groups')
      #7 src/addons/vw/vw/_core/model/user/xf2.php(201): XF\Mvc\Entity\Entity->toArray()
      #8 src/addons/vw/vw/_core/model/user/xf2.php(343): vw_User_Model_XF2->get()
      #9 src/addons/vw/vw/_core/model/ui/vw.php(32): vw_User_Model_XF2->is_admin()
      #10 src/addons/vw/vw/_core/view/integrate/vw.php(238): vw_UI_Model->check('has_integrate_t...', Array)
      #11 src/addons/vw/vw/_core/view/integrate/vw.php(168): vw_Integrate_View->fetch(Array)
      #12 src/addons/vw/vw/Listener.php(104): vw_Integrate_View->inject('<!DOCTYPE html>...')
      #13 src/addons/vw/vw/Listener.php(164): vw\vw\Listener::app_complete_html('<!DOCTYPE html>...')
      #14 [internal function]: vw\vw\Listener::app_complete(Object(XF\Pub\App), Object(XF\Http\Response))
      #15 src/XF/Extension.php(67): call_user_func_array(Array, Array)
      #16 src/XF/App.php(2395): XF\Extension->fire('app_complete', Array, NULL)
      #17 src/XF/App.php(1737): XF\App->fire('app_complete', Array)
      #18 src/XF/Pub/App.php(368): XF\App->complete(Object(XF\Http\Response))
      #19 src/XF/App.php(1937): XF\Pub\App->complete(Object(XF\Http\Response))
      #20 src/XF.php(333): XF\App->run()
      #21 index.php(13): XF::runApp('XF\\Pub\\App')
      #22 {main}
      Request state
      array(4) {
        ["url"] => string(8) "/forums/"
        ["referrer"] => string(24) "http://127.0.0.1/"
        ["_GET"] => array(0) {
        }
        ["_POST"] => array(0) {
        }
      }
    Issue Details
    Issue Number 5586
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category Templates
    Status Forum Bug
    Priority 2 - Fatal / Database Errors
    Affected Version 4.2.0 Alpha 1
    Fixed Version (none)
    Milestone (none)
    Software DependencyAny
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags Server Errors, templates, xenforo




    1. January 7, 2019 7:22 PM
      pegasus pegasus is offline
      VaultWiki Team
      These errors occur when trying to read a value called 'ncms_groups'. I'm not aware of a default field with that name. It is likely from another add-on that you have installed. Please provide the add-on name so we can try to investigate the conflict.
      Reply Reply  
    2. January 7, 2019 10:07 PM
      badgernz badgernz is offline
      New Member
      Hi Pegasus,

      We have discovered that it is the MineSync Addon that is creating the group.

      Thanks,
      Reply Reply  
    3. January 8, 2019 11:37 AM
      pegasus pegasus is offline
      VaultWiki Team
      Since that is a commercial add-on, you will either need to follow-up with them on the issue or submit a ticket here.

      I suspect it might be a bug in that add-on where ncms_groups specifies Entity::REQUIRES_DECODING but implements its own decoder in the Entity or Finder rather than in the ValueFormatter. This could trigger a double-decode in certain situations. It could be something else, but that is the first thing I would look at.
      Reply Reply  
    4. January 13, 2019 9:20 PM
      badgernz badgernz is offline
      New Member
      Hey Pegasus,

      I have created a ticket with the creators of MineSync who have said after a quick look they cant see anything wring with the implementation on their side however they will look into it further in the morning. They were also after an email address that you could be reached on incase they need to discuss this with you. (PM it to me if you wish unless there's a public one)

      Thanks.
      Reply Reply  
    5. January 14, 2019 1:15 PM
      pegasus pegasus is offline
      VaultWiki Team
      I'm not sure how helpful I can be, since I can't actually see the MineSync code, but they can reach me at this email if they need to:
      Code:
      support@vaultwiki.org
      The only thing VaultWiki is doing here is calling the ::toArray method which is a core XenForo method on the User entity. This method is supposed to return an array with the entity's database columns as array keys and the values of those columns as the corresponding array values. But when XenForo tries to complete this operation, it encounters a problem with the 'ncms_groups' column. Based on my reading of the stack trace, it seems like XenForo sees that the column requires decoding, but the value it tries to decode has already been decoded.
      Reply Reply  
    6. January 29, 2019 6:57 PM
      badgernz badgernz is offline
      New Member
      Hey Pegasus, Minesync replied earlier this month with the following,

      Apantic (Apantic)

      Jan 17, 17:24 GMT

      Can you let them know of the following:

      --

      The structure defining the column is the following:

      Code:
              $structure->columns['ncms_groups'] = [
                  'type' => self::LIST_COMMA,
      
                  'default' => [],
      
                  'list' => ['type' => 'posint', 'unique' => true, 'sort' => SORT_NUMERIC],
      
              ];
      It's similar to the definition for the secondary_group_ids column in xf_user. At no other point is any special decoding done on this value. It is accessed normally. The error experienced by the customer in this case isn't one I've seen or had reported before, so I would guess that the incompatibility is limited to being between MineSync and VaultWiki. We do not extend any other related functions on the XF User entity. Let me know if you have any thoughts - I cannot seem to reproduce this or see anything we do with this field that could cause a double-decode.

      --

      As noted before, if there's anything related specifically to our code that should be changed in order to fix the bug we'll be happy to do that. But this may just be an issue with something VaultWiki is doing. Hate to pass you around between two add-on developers here, but there's not much we can do until it's possible to track down which add-on is causing the issue and what is causing the incompatibility.
      Regards,
      Apantic Support
      Reply Reply  
    7. January 30, 2019 2:36 PM
      pegasus pegasus is offline
      VaultWiki Team
      Using the definition provided by MineSync devs:
      Code:
              $structure->columns['ncms_groups'] = [
                  'type' => self::LIST_COMMA,
      
                  'default' => [],
      
                  'list' => ['type' => 'posint', 'unique' => true, 'sort' => SORT_NUMERIC],
      
              ];
      When 'ncms_groups' is a column on \XF\Entity\User, it is easily reproducible with the following code (VaultWiki not required):
      Code:
      $user = \XF::repository('XF:User')->getGuestUser();
      $user->toArray();
      Both are stock XenForo methods. As stated in an earlier post, the only way VaultWiki was involved was that it called $user->toArray() in its code.

      Surprisingly, this problem is a design flaw in XenForo. The issue should be reported to both XenForo developers (for a true fix) and to MineSync developers (for a workaround). Analysis of the issue, including possible workaround, below:

      The default \XF\Repository\User::getGuestUser instantiates an empty user entity using the column-default (the column-default is supposed to be a decoded value, as evidenced by core \XF\Entity\User $structure->columns['secondary_group_ids']). In your case, the custom ncms_groups LIST_COMMA field has a default value of []. \XF\Repository\User::getGuestUser passes this to the new entity's $this->_values at instantiation. However, \XF\Mvc\Entity\Entity::getValue expects that $this->_values contains encoded values, not decoded values.

      To correct this bug, XenForo developers should check whether a column REQUIRES_DECODING and apply that to the default value before passing a column-default into a new entity (read: the stock code in \XF\Repository\User::getGuestUser is flawed). I feel they should also provide a new instantiate method (instantiateDecoded?) for entities which takes fully-decoded $values and encodes them back automatically (for potential cases of toArray followed by instantiateEntity), or that the current instantiate method be made smart enough to handle mixed incoming $values.

      The developer of MineSync can workaround the bug in this instance by creating another code-event listener for event visitor_guest_setup:
      Code:
      function visitor_guest_setup(&$defaults)
      {
      $defaults['ncms_groups'] = '';
      }
      Which will force the guest entity to be passed an encoded comma-list rather than the decoded default-value.

      This is potentially a major design flaw in XenForo as it could affect significant amounts of code, in both default XenForo and in any add-ons, that expects to pass default values into a new entity as-is, or expects to pass the output of \XF\Mvc\Entity\Entity::toArray of one entity back into the $values argument of a fresh entity as-is.

      There is nothing VaultWiki can do about the issue from its side as it simply expects the toArray method to work without throwing an error.
      Reply Reply  
    8. January 30, 2019 5:35 PM
      badgernz badgernz is offline
      New Member
      Oh wow, thank you for your analysis Pegasus. I will raise this with both Xenforo and Minesync.
      Reply Reply  
    9. November 15, 2019 11:46 PM
      fb88betasia fb88betasia is offline
      New Member
      Thank for your sharing!
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 11:29 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.