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

Fixed Code error in XenForo/Model/Node.php with render options in php 5.4 or greater

Discussion in 'Resolved Bug Reports' started by lms, Feb 16, 2013.

  1. lms

    lms Well-Known Member

    When you try to use a custom renderOptions in ACP, it's get an error so:
    I think it's a mistake to XenForo with php 5.4+. In the file library/XenForo/Model/Node.php, in 1255 there is this code line:
                    'selected' => (strval($selectedNodeId) === '0'),
    that generates an error when the variable $selectedNodeId is an array of selected nodes, and the error occurs.
    I changed this line to:
                    'selected' => (!$selectedNodeId $selectedNodeId 0),
    and works fine for me. I can use the 'All' selector in render options and all add-ons.

    Luis and Adam Howard like this.
  2. lms

    lms Well-Known Member

    Better yet
                    'selected' => (!$selectedNodeId true false),
    Adam Howard likes this.
  3. Mike

    Mike XenForo Developer Staff Member

    That's not really the correct fix so I've done a different one to prevent the error, but note that $selectedNodeId is expected to be an integer, so passing an array in isn't documented behavior.
    Slavik likes this.
  4. lms

    lms Well-Known Member

    With this change, it works fine for me:
                    'selected' => (!$selectedNodeId ? '0' : '1'),

Share This Page