ZF-12159: Zend_File_Transfer_Adapter_Http "workaround" causing unexpected behavior with XMLHttpRequest Level 2
This bug is related (but not duplicate) of an ZF-10279.
When you are using FormData (from XMLHttpRequest Level 2 - see http://dvcs.w3.org/hg/xhr/…), aka "AJAX file upload", and you don't select any file, the $_SERVER['CONTENT_LENGTH'] will be > 0. This is not a bug, but correct behavior according to the W3 specs (the form is send as multipart, but there is file missing, so the file item is treated as string not File or Blob object, and then the Content-Type: application/octet-stream header is not added). The $_FILES is empty then, but it confuses ZF, because the $content is larger than 0, which activate the "workaround", add error = 1 and resulting in confusing "File exceeds the defined ini size" (fileUploadErrorIniSize) error warning of Zend_Validate_File_Upload.
Because browsers are already getting support of the direct XMLHttpRequest file upload methods, I suppose this has to be somehow detected (maybe with the fix proposed in the ZF-10279?).