From ad9124d0454349c588831878035d253df183efb2 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Tue, 13 May 2014 16:13:56 +0200 Subject: [PATCH] MDL-36670 logging: action parameter length restricted to 40 chars --- lib/datalib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/datalib.php b/lib/datalib.php index 475dc6093e9..c6ad008a255 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1607,6 +1607,11 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user // database so that it doesn't cause a DB error. Log a warning so that // developers can avoid doing things which are likely to cause this on a // routine basis. + if (textlib::strlen($action) > 40) { + $action = textlib::substr($action, 0, 37) . '...'; + debugging('Warning: logged very long action', DEBUG_DEVELOPER); + } + if(!empty($info) && textlib::strlen($info)>255) { $info = textlib::substr($info,0,252).'...'; debugging('Warning: logged very long info',DEBUG_DEVELOPER);