AJAX request fails when sending FormData() including empty file input in Safari 10.13.4 : <p>I am running a Symfony 2.8 based web app which sends some form data back to a controller using Ajax.</p>

<p>So far everything worked fine, but since the latest macOS update to version 10.13.4 users start to report, that submitting the form does not work anymore in Safari. Other macOS Versions and other browsers on 10.13.4 still work fine, so it seems to be a problem in Safari. Of course I filed a bug report to Apple, but I do not think, that I will ever get feedback from there...</p>

<p>I was able to isolate the source of the problem: Submitting data which includes an empty file input fails:</p>

<pre><code>// safri_bug.html
&lt;html&gt;
    &lt;head&gt;
        &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
&lt;body&gt;
    &lt;form name="app_booking" method="post" action="/test/submit.php"&gt;
        &lt;div&gt;&lt;input type="text" id="someValue" name="value"&gt;&lt;/div&gt;
        &lt;div&gt;&lt;input id="thefile" type="file" name="file"&gt;&lt;/div&gt;
    &lt;/form&gt;

    &lt;button id="bSubmit" type="button"&gt;Submit&lt;/button&gt;

    &lt;script&gt;    
        $(document).ready(function() {              
            $('#bSubmit').click(function() {
                var form = $('form');
                var data = new FormData(form[0]);

                $.ajax({
                    url : '/submit.php',
                    type : 'POST',
                    data : data,
                    contentType: false,
                    processData: false,
                    context : this,
                    success : function(response) {
                            alert('success: ' + response);
                    },
                    error: function (xhr, ajaxOptions, thrownError) {
                            alert('error: ' + xhr.responseText + ' - ' + thrownError);
                    }
                });
            });
        });
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;


// submit.php
&lt;?php 
    echo "OK";
</code></pre>

<p><strong>Result</strong></p>

<ul>
<li>Submitting the form works fine on all tested browsers and platforms but in Safari in macOS 10.13.4</li>
<li>In Safari on macOS 10.13.4:

<ul>
<li>If not file is selected: The Ajax request runs for about 20 seconds (build in timeout?) and than returns with an empty sucess response. The <code>submit.php</code> does <strong>NOT</strong> get called. </li>
<li>If a file was selected: Everything works fine...</li>
</ul></li>
</ul>

<p><strong>So, this seems to be a bug in the latest Safari update? Or is there anything wrong with my code?</strong></p>

<p>Any idea how to prevent this bug?</p>
