Please help me make sense of this "zend_mm_head corrupted" error?
<p>I have a fairly large restless API built on Tonic PHP. Usually everything works perfectly across all browsers, but today I stumbled across something new. This resource:</p>

<pre><code>&lt;?php

namespace dispatch_resources;

// Use Tonic classes
use \Resource,
    \Request,
    \Response;

// Other broadnet classes
use \broadnet\Helpers,
    \broadnet\TabularData,
    \broadnet\files\File as _File;

/**
 * This resource returns a variable portion of the uploaded tabular data file.
 * Also returns the column headers
 * 
 * @author Tomas Sandven &lt;tomas191191@gmail.com&gt;
 * @package bito
 * 
 * @uri /tabulardatafilepreview
 **/
class TabularDataFilePreview extends Resource
{
    private $defaultRowNumber = 10;

    /**
     * POST resource. Should receive a file as input, as well as the amount of
     * rows the output should contain
     **/
    public function post($request)
    {
        // Ready the response
        $response = new Response($request);

        // Fetch the requested file type
        $requested_type = $request-&gt;accept[10][0];

        // Throw 404 for anything except JSON for now
        if($requested_type !== 'json')
        {
            $response-&gt;code = Response::NOTFOUND;
            return $response;
        }

        // Use the input file
        if(array_key_exists('file', $_FILES))
        {
            $file_array = $_FILES['file'];
            $file = _File::fromUpload($file_array);
        }
        // Or the input file handle
        else if(array_key_exists('file_handle', $_POST))
        {
            $file = _File::fromHandle($_POST['file_handle']);
        }
        // Or return an error if no file or file handle was input
        else
        {
            $response-&gt;body = Helpers::getJsonError(
                "Didn't receive a file or file handle"
            );
            return $response;
        }

        // Fetch row number. Use one provided as POST data or use the default
        if(array_key_exists('rownum', $_POST))
        {
            $rownum = intval($_POST['rownum']);
        }
        else
        {
            $rownum = $this-&gt;defaultRowNumber;
        }

        try
        {
            // Open tabular data instance
            $td = TabularData::fromFile($file);

            // Build a response
            $response_text = json_encode(array(
                "headers" =&gt; $td-&gt;columns,
                "rows" =&gt; array_slice($td-&gt;data, 0, $rownum)
            ));

            // Set response data and return it
            $response-&gt;body = $response_text;
        }
        catch(Exception $e)
        {
            $response-&gt;body = Helpers::getJsonError($e-&gt;getMessage());
        }

        return $response;
    }
}
</code></pre>

<p>Did it's job perfectly in FireFox (using Ajax) but for some reason it would crash PHP when requested from Chrome Ajax. I finally narrowed it down to the request header</p>

<pre><code>Accept-Language: en-us,en;q=0.5
</code></pre>

<p>Which FireFox tagged on automatically, but was absent in Chrome. When I manually added the header to the Chrome Ajax requests it worked smoothly again. I can't for the life of me understand why the lack of that header would cause PHP to crash and return an empty response (with no headers).</p>

<p>After some more debugging (placing <code>exit</code>s around in the code) I figured out that the application crashes on line 81 (<code>$td = TabularData::fromFile($file);</code>), but only after the file had been loaded and the data is being extracted. It's also worth mentioning that the crashes only happens when the file in question is in the XLSX format and is being handles by the PHPExcel library. Undoubtedly the error lies in there.</p>

<p>I'd still REALLY like an explanation as to how this one header makes the difference, especially seeing that other Requests do this exact same thing without crashing. My mind is just so blown.</p>

<p>Thanks</p>
