diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2013-09-30 23:07:03 +0200 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2013-09-30 23:07:03 +0200 |
commit | b3c158619506f993fe94fa1f119de8481b3ef5d0 (patch) | |
tree | c19696d72c4471832e7981031cf3a1234f9af4f0 /framework/Web/UI/ActiveControls/TActivePageAdapter.php | |
parent | 46c942c6b38120755983286313a6187078ffe27c (diff) |
Better handling of callback errors on request containing non-UTF8
Previously we reported being unable to correctly encode the error
string; report the original error instead
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActivePageAdapter.php')
-rw-r--r-- | framework/Web/UI/ActiveControls/TActivePageAdapter.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php index 5e86f8b8..d90d0997 100644 --- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php +++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php @@ -347,7 +347,13 @@ class TCallbackErrorHandler extends TErrorHandler if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) { $response = $this->getApplication()->getResponse(); - $trace = TJavaScript::jsonEncode($this->getExceptionStackTrace($exception)); + $trace = $this->getExceptionStackTrace($exception); + try { + $trace = TJavaScript::jsonEncode($trace); + } catch (Exception $e) { + // strip everythin not 7bit ascii + $trace = preg_replace('/[^(\x20-\x7F)]*/','', serialize($trace)); + } $response->setStatusCode(500, 'Internal Server Error'); $response->appendHeader(TActivePageAdapter::CALLBACK_ERROR_HEADER.': '.$trace); } |