From 05e042427bf9eb03eea7f7e94dd21c09360210f0 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 13 Nov 2008 21:02:54 +0000 Subject: [PATCH] BUGFIX #3061: Text.FirstSentence returns '.' instead of '' on an empty field git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@65842 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/fieldtypes/Text.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/model/fieldtypes/Text.php b/core/model/fieldtypes/Text.php index a2921c3ea..ed6980916 100644 --- a/core/model/fieldtypes/Text.php +++ b/core/model/fieldtypes/Text.php @@ -96,6 +96,8 @@ class Text extends DBField { */ function FirstSentence() { $data = Convert::xml2raw( $this->value ); + if( !$data ) return ""; + $sentences = explode( '.', $data );