#218 web form issues due to post fields being truncated

open-works-for-me
Web tester (52)
5
2012-07-10
2012-06-22
Anonymous
No

I have been having trouble getting a login working using the the
browser module, this is only happening on one particular server which is
RHEL6 - php 5.3.13.

Basically the login fails, with the remote server rejecting the request.
On closer inspection, the post parameters appear to be truncated. i.e
there is a validation key that should be

"/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA=="

but simpletest appears to be sending the following in the post instead

""/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA"

It appears the the '=' characters are being stripped off by mergeAttributes() in tidy_parser.php, however it also appears that the unaffected machines do not take this code path.

Discussion

  • Perrick Penet

    Perrick Penet - 2012-07-01
    • labels: --> Web tester
    • assigned_to: nobody --> pp11
    • status: open --> pending-works-for-me
     
  • Perrick Penet

    Perrick Penet - 2012-07-01

    I tried to replicate your bug with the following patch :

    ### Eclipse Workspace Patch 1.0
    #P simpletest
    Index: test/acceptance_test.php
    ===================================================================
    --- test/acceptance_test.php (revision 2050)
    +++ test/acceptance_test.php (working copy)
    @@ -1079,6 +1079,13 @@
    $this->assertText("i=[']");
    }

    + function testSubmissionOfTrickyPostValue() {
    + $this->get($this->samples() . 'form_with_tricky_post_value.html');
    + $this->assertField('Text A', '/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA==');
    + $this->click('Go!');
    + $this->assertText("wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA==");
    + }
    +
    function testFormActionRespectsBaseTag() {
    $this->get($this->samples() . 'base_tag/form.html');
    $this->assertTrue($this->clickSubmit('Go!'));
    Index: test/site/form_with_tricky_post_value.html
    ===================================================================
    --- test/site/form_with_tricky_post_value.html (revision 0)
    +++ test/site/form_with_tricky_post_value.html (revision 0)
    @@ -0,0 +1,10 @@
    +<html>
    + <head><title>Test of form submission</title></head>
    + <body>
    + <form action="network_confirm.php" method="post">
    + <label>Text A <input type="text" name="a" value="/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA=="></label>
    + <br />
    + <input type="submit" value="Go!">
    + </form>
    + </body>
    +</html>
    \ No newline at end of file

    Property changes on: test/site/form_with_tricky_post_value.html
    ___________________________________________________________________
    Added: svn:executable
    + *

    But things are looking OK on my machine. Maybe you could elaborate on this code to provide a failing test case and we can find the root cause more easily.

    Thanks in advance,
    Perrick

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-07-10

    indeed, your given test case fails on the affected machine. See result below.

    6) Field [Text A] should match with [Field expectation [String: /wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA==] fails with [String: "/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA] at character 0 with [/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA==] and ["/wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA]] at [/home/dart/trunk/test/acceptance_test.php line 1086]
    in testSubmissionOfTrickyPostValue
    in LiveTestOfForms
    7) Text [wEWBgKg39dCAtHo2bAJAoCO7/gFAraE6F8CoejZkAICz5yEggoKjWoDPyV4u4qbEbtGzIJvWG8IkA==] not detected in [String: Simple test target file A target for the SimpleTest test suite. Request Protocol versionHTTP/1.0 Request methodPOST Accept header Cookies Raw GET data [] GET data Dump of $_GET data Array ( ) Raw POST...] at [/home/dart/trunk/test/acceptance_test.php line 1089]
    in testSubmissionOfTrickyPostValue
    in LiveTestOfForms

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-07-10
    • status: pending-works-for-me --> open-works-for-me
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-07-12

    Turns out this depends on the pasrser being used. So to reproduce this error, you just need to ensure that using the Tidy Parser. On a machine with the php tidy extension loaded, then it will be using SimpleTidyPageBuilder() which causes it to fail.

    Once I remove the tidy extension, it then uses SimplePHPPageBuilder, which handles the post field correctly.

    Its not clear to me why there are two different parsers in simpletest? but it does seem that TidyParser is the preferred one, and PHP parser is a fallback, for when the tidy extension is missing.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks