Module

Archived
Forum
(read-only)

Google Custom Search

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4

Back to this add-on's main page
View Other Add-ons From Derek Hogue

     

PHP error using specific search term

Support (Resolved)

Tim Bertens
Tim Bertens

Hi Derek,

I have a very weird problem on a customer’s site that has been using this module for almost 2 years now. 

The site is running EE 2.5.2
GCS is of version 1.1.1 (tried 1.1.3 too, but same problem)

The search module is producing results in the correct way for almost all search terms, but 2 (as far I found out now)... Our customer reported today that using the search-term ‘ligger’ or ‘i-ligger’ (dutch terms in building industry) then the search page is empty.  Looking from my side on a development machine with debugging on, I can see the following error

Parse errorsyntax errorunexpected T_ENDIF in /Applications/MAMP/htdocs/eurabo.local/admin/expressionengine/libraries/Functions.php(680) : eval()'d code on line 218 

The relevant parts of the template debugger shows normal stuff if you ask me

(0.013826 2.40MB) Tag{exp:google_custom_search:form results_page="nl/search/results" id="search_form" class="form"}
(0.013888 2.40MB) Closing Tag Found
(0.013945 2.41MBTag{exp:google_custom_search:results cse="017331335665742158850:ae3foaaxycc" api_key="AIzaSyDyF1rxFhrmTX-cmkHR1cpuU_HYmjiX1fE" language="lang_nl"" keywords="36042fbb8c9409170c016c5579be1c59" replace_title=" Eurabo" site="http://www.eurabo.be/nl/"}
(0.014034 2.41MBClosing Tag Found
(0.014094 2.41MBProcessing Tags
(0.014126 2.41MBPlugin TagCe_str/ing
(0.014148 2.41MBPlugin TagBbr_langswitcher/
(
0.014168 2.41MBModule TagGoogle_custom_search/form
(0.014186 2.41MBModule TagGoogle_custom_search/results
(0.014203 2.41MBIncluding Files for Plugins and Modules
(0.014729 2.47MBFiles for Plugins and Modules All Included
(0.015614 2.50MBBeginning Final Tag Data Processing
(0.015642 2.50MBCalling Class/MethodCe_str/ing
(0.015763 2.50MB) -> Class CalledCe_str
(0.015794 2.50MB) -> Method Calleding
(0.015932 2.50MB) -> Data Returned
(0.015960 2.50MBCalling Class/MethodBbr_langswitcher/
(
0.016184 2.50MB) -> Class CalledBbr_langswitcher
(0.017021 2.50MB) -> Method CalledBbr_langswitcher
(0.017082 2.50MB) -> Data Returned
(0.017108 2.50MBCalling Class/MethodGoogle_custom_search/form
(0.017180 2.50MB) -> Class CalledGoogle_custom_search
(0.017428 2.51MB) -> Method Calledform
(0.018193 2.58MBCalling Extension Class/MethodSafecracker_ext/form_declaration_modify_data
(0.018439 2.57MB) -> Data Returned
(0.018469 2.57MBCalling Class/MethodGoogle_custom_search/results
(0.018807 2.57MB) -> Class CalledGoogle_custom_search
(0.018907 2.57MB) -> Method Calledresults
(0.019413 2.58MB) -> Going to perform a search for keywordsligger
(0.019536 2.58MB) -> About to make cURL request tohttps://www.googleapis.com/customsearch/v1?alt=json&fields=queries,items(title,htmlTitle,link,snippet,htmlSnippet,pagemap/cse_image,pagemap/cse_thumbnail)&cx=017331335665742158850:ae3foaaxycc&key=AIzaSyDyF1rxFhrmTX-cmkHR1cpuU_HYmjiX1fE&q=ligger&num=10&siteSearch=http://www.eurabo.be/nl/&siteSearchFilter=i&safe=off&lr=lang_nl&filter=0&start=1&userIp=127.0.0.1
(0.357859 2.59MB) -> cURL request successful
(0.358696 2.63MB) -> Decoded JSON results
(0.364588 2.75MB) -> Found 29 results for keywordsligger
(0.369396 2.74MB) -> Data Returned 

Can you help?
tx,
Tim

Derek Hogue
# 1
Developer
Derek Hogue

That error usually indicates a malformed template conditional. I’d start by hunting through the results template and double-checking and/or removing all conditional statements one by one.

Post your template code if you like and I can look over it.

Tim Bertens
# 2
Tim Bertens

Hi Derek,

sorry for the late response, we were on holiday last week…
I have been looking further into this and without touching a single line of code it is working again for all search terms (including the one that gave errors before)

Very strange, but I suppose it must have been a malformed answer from Google?

Tim

Derek Hogue
# 3
Developer
Derek Hogue

Hmm, seems unlikely that the results from Google could trigger this error. It is most definitely a bad conditional error. Glad it seems to be sorted though!