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

Server Issue Error when creating thread with draft

Discussion in 'Resolved Bug Reports' started by Jake B., Nov 2, 2015.

  1. Jake B.

    Jake B. Well-Known Member

    Steps to reproduce:
    1. Go to create new thread page
    2. click 'save draft'
    3. refresh page
    Only happens when you have debug mode on. This happened on a clean XF 1.5.2 install with no add-ons or styles.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Not tested or looked at the code in detail but I have just quickly tested this and I cannot reproduce it.

    Can you consistently reproduce this? Or are there any missing steps?
     
  3. Jake B.

    Jake B. Well-Known Member

    I've been able to consistently replicate this on XF 1.5.2 with those steps. It was on our test board with all add-ons disabled and on the default style. I'll shoot you a PM with username/password for an admin account so you can see it
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Sorry for the delay in looking at this in more detail.

    I believe this to be a server issue which we have come across before, I'll try and find some more details surely.

    Specifically, this is what {$poll} looks like under normal conditions after being saved as a draft, on my machine:
    Code:
    array(6) {
      ["question"] => string(0) ""
      ["responses"] => array(0) {
      }
      ["max_votes_type"] => string(6) "single"
      ["change_vote"] => string(1) "1"
      ["view_results_unvoted"] => string(1) "1"
      ["extraResponses"] => array(2) {
        [0] => bool(true)
        [1] => bool(true)
      }
    }
    This is what {$poll} looks like on your server:
    Code:
    array(3) {
      ["max_votes_type"] => string(6) "single"
      ["change_vote"] => string(1) "1"
      ["view_results_unvoted"] => string(1) "1"
    }
    Again, I will try and specifically point you in the direction of what is causing this (we've seen it before), but generally speaking something on your server is unsetting keys from $_POST where the value is "falsey".
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    Ah, that was easier to find than I expected. From a recent ticket which was similar:
    So, as it says, by default suhosin discards vales from $_POST where the value is empty. I have no idea why that would ever be a useful feature, but if you have suhosin you should look into disabling that feature. In the first instance, you might want to just try disabling the suhosin extension completely to see if that fixes the problem.
     
    Jake B. and Steve F like this.
  6. Jake B.

    Jake B. Well-Known Member

    I've got apache rebuilding now with suhosin disabled. Will reply after that's done
     
    Chris D likes this.
  7. Jake B.

    Jake B. Well-Known Member

    Yep! That did it :)
     
    Chris D likes this.
  8. Jake B.

    Jake B. Well-Known Member

    Could I suggest changing this:

    Code:
    <xen:foreach loop="$poll.responses" value="$response">
                        <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" value="{$response}" /></li>
                    </xen:foreach>
                    <xen:foreach loop="$poll.extraResponses" value="$null">
                        <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
                    </xen:foreach>
    
    to this:
    Code:
                   <xen:if is="is_array($poll.responses)">
                   <xen:foreach loop="$poll.responses" value="$response">
                        <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" value="{$response}" /></li>
                    </xen:foreach>
                   </xen:if>
    
                   <xen:if is="is_array($poll.extraResponses)">
                    <xen:foreach loop="$poll.extraResponses" value="$null">
                        <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
                    </xen:foreach>
                    </xen:if>
    
    It might help save some confusion for people if they happen to have debug mode on :)
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    Well, it's not really necessary. There's actually a whole load of places where the specific issue you encountered could cause pretty fundamental issues to the operation of XF. Off the top of my head I can think of a number of places which would more than likely fall over due to this issue. Even things like undefined indexes because we are looking for indexes which should definitely be there, but they aren't because they've been stripped out.

    Realistically, it's better to not suppress these kinds of things because they are indicating a much more sinister problem that needs attention.
     
  10. Jake B.

    Jake B. Well-Known Member

    Ah yeah, fair enough. Any chance you know the specific suhosin configuration that causes this? I've searched for it but can't seem to come up with anything so I've just disabled it
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    I'm not certain, but looking at their somewhat vague documentation I would guess it's:
    Code:
    suhosin.post.disallow_nul
    suhosin.post.disallow_ws
     

Share This Page