From 55294b1f9626f566a8218323222a8e6f5cb41f09 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 15 Oct 2010 00:31:26 +0000 Subject: [PATCH] BUGFIX: check if a request is present before using it to prevent undefined errors (from r104608) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112357 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- search/ContentControllerSearchExtension.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/search/ContentControllerSearchExtension.php b/search/ContentControllerSearchExtension.php index 7d9731c96..b0ad72d12 100644 --- a/search/ContentControllerSearchExtension.php +++ b/search/ContentControllerSearchExtension.php @@ -15,7 +15,12 @@ class ContentControllerSearchExtension extends Extension { * Site search form */ function SearchForm() { - $searchText = ($s = $this->owner->request->getVar('Search')) ? $s : _t('SearchForm.SEARCH', 'Search'); + $searchText = _t('SearchForm.SEARCH', 'Search'); + + if($this->owner->request) { + $searchText = $this->owner->request->getVar('Search'); + } + $fields = new FieldSet( new TextField('Search', false, $searchText) );