diff options
author | Zach Copley <zach@status.net> | 2009-11-06 17:21:08 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-11-06 17:21:08 -0800 |
commit | b522c401e66e5b5d7e000c1bf25fd4b4a4d0558f (patch) | |
tree | 1140fcb28c1e7bd3dca8c088565b68125a0c26fd /actions/avatarsettings.php | |
parent | f7b0017f219d649a3acb3d650cb6d4fbb79b9956 (diff) |
Better workaround for PHP returning empty $_POST and $_FILES when
POST length > post_max_size in php.ini. I also added this check to
avatar upload, which was failing with huge files.
Diffstat (limited to 'actions/avatarsettings.php')
-rw-r--r-- | actions/avatarsettings.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index ded419dd7..879e44842 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -244,11 +244,25 @@ class AvatarsettingsAction extends AccountSettingsAction function handlePost() { + // Workaround for PHP returning empty $_POST and $_FILES when POST + // length > post_max_size in php.ini + + if (empty($_FILES) + && empty($_POST) + && ($_SERVER['CONTENT_LENGTH'] > 0) + ) { + $msg = _('The server was unable to handle that much POST ' . + 'data (%s bytes) due to its current configuration.'); + + $this->showForm(sprintf($msg, $_SERVER['CONTENT_LENGTH'])); + return; + } + // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->show_form(_('There was a problem with your session token. '. + $this->showForm(_('There was a problem with your session token. '. 'Try again, please.')); return; } |