Commit f1796178 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1219 printwbxml sets WBXML_DEBUGGING flag to use different internal

routines.

Released under the Affero GNU General Public License (AGPL) version 3.
parent e232e4c6
...@@ -320,7 +320,7 @@ class WBXMLDecoder extends WBXMLDefs { ...@@ -320,7 +320,7 @@ class WBXMLDecoder extends WBXMLDefs {
// when sending an email with an attachment this single log line (which is never logged in INFO) // when sending an email with an attachment this single log line (which is never logged in INFO)
// requires easily additional 20 MB of RAM. See https://jira.z-hub.io/browse/ZP-1159 // requires easily additional 20 MB of RAM. See https://jira.z-hub.io/browse/ZP-1159
$messagesize = strlen($el[EN_CONTENT]); $messagesize = strlen($el[EN_CONTENT]);
if ($messagesize > 10240) { if ($messagesize > 10240 && !defined('WBXML_DEBUGGING')) {
$content = substr($el[EN_CONTENT], 0, 10240) . sprintf(" <log message with %d bytes truncated>", $messagesize); $content = substr($el[EN_CONTENT], 0, 10240) . sprintf(" <log message with %d bytes truncated>", $messagesize);
} }
else { else {
...@@ -405,6 +405,21 @@ class WBXMLDecoder extends WBXMLDefs { ...@@ -405,6 +405,21 @@ class WBXMLDecoder extends WBXMLDefs {
* @return string * @return string
*/ */
private function getTermStr() { private function getTermStr() {
if(defined('WBXML_DEBUGGING') && WBXML_DEBUGGING === true) {
$str = "";
while(1) {
$in = $this->getByte();
if($in == 0) {
break;
}
else {
$str .= chr($in);
}
}
return $str;
}
// there is no unlimited "length" for stream_get_line, // there is no unlimited "length" for stream_get_line,
// so we use a huge value for "length" param (1Gb) // so we use a huge value for "length" param (1Gb)
// (0 == PHP_SOCK_CHUNK_SIZE (8192)) // (0 == PHP_SOCK_CHUNK_SIZE (8192))
......
...@@ -35,6 +35,9 @@ include_once('../../src/lib/wbxml/wbxmldefs.php'); ...@@ -35,6 +35,9 @@ include_once('../../src/lib/wbxml/wbxmldefs.php');
include_once('../../src/lib/wbxml/wbxmldecoder.php'); include_once('../../src/lib/wbxml/wbxmldecoder.php');
include_once('../../src/lib/wbxml/wbxmlencoder.php'); include_once('../../src/lib/wbxml/wbxmlencoder.php');
// don't truncate WBXML logs and use slow stream reader
define('WBXML_DEBUGGING', true);
// minimal definitions & log to stdout overwrite // minimal definitions & log to stdout overwrite
define('WBXML_DEBUG', true); define('WBXML_DEBUG', true);
define("LOGLEVEL_WBXML", "wbxml"); define("LOGLEVEL_WBXML", "wbxml");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment