Multiple Calls to POST data cause error with pdf generation



  • I have a form page and a pdf (generated with mpdf).
    On the form page is the code:

    <form method="POST" action="/posted.php">
    <input type="text" name="word[]" value="hi" />
    <input type="submit">
    </form>
    

    On the pdf generation page is:

    <?php
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    
    include_once($_SERVER['DOCUMENT_ROOT']."/mpdf/mpdf.php");
    $mpdf=new mPDF();
    $mpdf->WriteHTML();
    $mpdf->Output();
    ?>
    

    This will cause the pdf to not render in vivaldi (it works fine in Firefox, Chrome, Opera, Safari).
    Alternatively you could substitute the shuffles for any other action that calls the $_POST variable.
    ie:

    <?php
    array_reverse($_POST['word']);
    array_reverse($_POST['word']);
    array_reverse($_POST['word']);
    array_reverse($_POST['word']);
    array_reverse($_POST['word']);
    
    include_once($_SERVER['DOCUMENT_ROOT']."/mpdf/mpdf.php");
    $mpdf=new mPDF();
    $mpdf->WriteHTML();
    $mpdf->Output();
    ?>
    

    If you remove even one of the calls to the POST data it does render fine though.
    Ie:

    <?php
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    shuffle($_POST['word']);
    
    include_once($_SERVER['DOCUMENT_ROOT']."/mpdf/mpdf.php");
    $mpdf=new mPDF();
    $mpdf->WriteHTML();
    $mpdf->Output();
    ?>
    

  • Moderator

    And did you test with Chromium 72 and 73 to assure it is not a chromium issue?

    May be your output needs a flush of output buffer.
    And the HTTP headers for caching should be checked.

    We hardly can setup a webserver, PHP and mPDF with packagist for this test!
    Please give us a test page and we can test it.


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.