From 8f119acf3192f5e9194f2bb8a4698cd665c145b1 Mon Sep 17 00:00:00 2001 From: shashenko Date: Fri, 29 Nov 2013 14:19:37 +0700 Subject: [PATCH] Check HTTP header size --- ChromePhp.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ChromePhp.php b/ChromePhp.php index 577b1ce..f04e098 100755 --- a/ChromePhp.php +++ b/ChromePhp.php @@ -77,7 +77,12 @@ class ChromePhp * @var string */ const TABLE = 'table'; - + + /** + * @var int + */ + const MAX_DATA = 200000; + /** * @var string */ @@ -391,7 +396,14 @@ protected function _addRow(array $logs, $backtrace, $type) protected function _writeHeader($data) { - header(self::HEADER_NAME . ': ' . $this->_encode($data)); + $encodedData = $this->_encode($data); + + if(strlen($encodedData) <= self::MAX_DATA){ + header(self::HEADER_NAME . ': ' . $encodedData); + }else{ + $this->_json['rows'] = array(); + self::warn('Data is too big!'); + } } /**