Commit a96fcd98 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #474 in ZP/z-push from...

Merge pull request #474 in ZP/z-push from bugfix/ZP-1159-sendmail-with-attachments-uses-too to develop

* commit 'aa6058f1':
  ZP-1159 Fix typo.
  ZP-1159 Add maxLength parameter to Request::GetInputAsBase64(), log 10KB in an WBXML exception case and 4KB in the happy case.
parents a41f7564 aa6058f1
......@@ -691,12 +691,14 @@ class Request {
* With POST request (our case), you can open and read
* multiple times "php://input"
*
* @param int $maxLength max. length to be returned. Default: return all
*
* @access public
* @return string - base64 encoded wbxml
*/
public static function GetInputAsBase64() {
public static function GetInputAsBase64($maxLength = -1) {
$input = fopen('php://input', 'r');
$wbxml = base64_encode(stream_get_contents($input));
$wbxml = base64_encode(stream_get_contents($input, $maxLength));
fclose($input);
return $wbxml;
}
......
......@@ -112,13 +112,15 @@ abstract class RequestProcessor {
}
}
catch (Exception $ex) {
ZLog::Write(LOGLEVEL_FATAL, "WBXML debug data: " . Request::GetInputAsBase64(), false);
// Log 10 KB of the WBXML data
ZLog::Write(LOGLEVEL_FATAL, "WBXML 10K debug data: " . Request::GetInputAsBase64(10240), false);
throw $ex;
}
// also log WBXML in happy case
if (ZLog::IsWbxmlDebugEnabled()) {
ZLog::Write(LOGLEVEL_WBXML, "WBXML-IN : ". Request::GetInputAsBase64(), false);
// Log 4 KB in the happy case
ZLog::Write(LOGLEVEL_WBXML, "WBXML-IN : ". Request::GetInputAsBase64(4096), false);
}
}
......
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