From 4634d21313cfc27bf658fe48409b8a2a5a24c7d3 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Tue, 1 Nov 2016 15:28:34 +0000 Subject: [PATCH] fixes: Minor bug fixes --- include/class.forms.php | 2 +- include/html2text.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/class.forms.php b/include/class.forms.php index 180057e81..b7bb2f93a 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1766,7 +1766,7 @@ class DatetimeField extends FormField { function to_database($value) { // Store time in gmt time, unix epoch format - return date('Y-m-d H:i:s', $value); + return $value ? date('Y-m-d H:i:s', $value) : $value; } function to_php($value) { diff --git a/include/html2text.php b/include/html2text.php index 0fcaa5cab..e7ddedeaf 100644 --- a/include/html2text.php +++ b/include/html2text.php @@ -1014,7 +1014,7 @@ function mb_wordwrap($string, $width=75, $break="\n", $cut=false) { } else { // Anchor the beginning of the pattern with a lookahead // to avoid crazy backtracking when words are longer than $width - $pattern = '/(?=[\s\p{Ps}])(.{1,'.$width.'})(?:\s|$|(\p{Ps}))/uS'; + $search = '/(?=[\s\p{Ps}])(.{1,'.$width.'})(?:\s|$|(\p{Ps}))/uS'; $replace = '$1'.$break.'$2'; } return rtrim(preg_replace($search, $replace, $string), $break); -- GitLab