1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-20 10:48:40 +01:00

Fix Firefox upload fatal

Summary:
Several problems:

  - With fpm-warmup, 'PhabricatorAccessLog' is always loaded, even if it hasn't actually initialized. Use a global instead (barf). I'll fix this when I refactor index.php, hopefully soon.
  - The 'POST' check isn't sufficient in Firefox for HTML5 uploads -- not 100% sure why, maybe it encodes post bodies differently? I added an additional '__file__' requirement, and will add this param to GET on all file uploads in a future diff.

See discussion in D2381.

Test Plan: Uploaded files with Firefox via drag-and-drop without various mysterious errors.

Reviewers: vrana, btrahan, jungejason

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2405
This commit is contained in:
epriestley 2012-05-05 11:28:30 -07:00
parent cd63d9b2ce
commit 9f9716f81f

View file

@ -17,10 +17,12 @@
*/
$__start__ = microtime(true);
$access_log = null;
error_reporting(E_ALL | E_STRICT);
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !$_POST) {
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !$_POST &&
isset($_REQUEST['__file__'])) {
$size = ini_get('post_max_size');
phabricator_fatal(
"Request size exceeds PHP 'post_max_size' ('{$size}').");
@ -353,15 +355,14 @@ function phabricator_shutdown() {
}
function phabricator_fatal($msg) {
if (class_exists('PhabricatorAccessLog', false)) {
$log = PhabricatorAccessLog::getLog();
if ($log) {
$log->setData(
array(
'c' => 500,
));
$log->write();
}
global $access_log;
if ($access_log) {
$access_log->setData(
array(
'c' => 500,
));
$access_log->write();
}
header(