problem with search: error on checkNoHTML

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
jpatti
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Sun Aug 03, 2008 6:05 am

problem with search: error on checkNoHTML

Post by jpatti » Fri Aug 15, 2008 8:04 pm

ENVIRONMENT

I am running Joomla 1.5.6 on Apache 1.3.41, PHP 4.4.8, MySQL 5.051a-community

Extensions I have installed include iJoomla RSS feeder, JCE editor, Xmap, yvcomment, OSTWigits' captcha, bannerslider and a homemade mod that just has some Javascript in it.

I have the Lightfast template from Joomlashack installed and customized.

PROBLEM

I have two methods of search on my site, both a search module published on most pages plus a link to the search component. In either case, when I do a search, I get a page that is entirely blank except for this error: Fatal error: Call to undefined function: checknohtml() in /public_html/plugins/search/content.php on line 253

ATTEMPTS TO SOLVE PROBLEM
STEP 1
The error message seems to be complaining that it can't find the function.

I had originally installed Joomla 1.5.3 on my host via Fantastico, and later used the upgrade to 1.5.5, then almost immediately had to install the 1.5.6 patch. Search had worked on 1.5.3 and I wasn't sure if it had worked on 1.5.5, but it was definitely broken on 1.5.6.

I thought perhaps this upgrade path had somehow missed a file, or perhaps one of my extensions had overwritten a file, and thus I'd lost the function in my installation. So I downloaded the entire 1.5.6 package, unzipped it, and FTP'd it up (except the installation directory).

This made absolutely no difference, I got the same error.

STEP 2
I was thinking along the lines of this perhaps being a built-in PHP function, so I tried enabling and disabling PHP 5 through cpanel just in case version 5 had functions not included in 4. This made no difference either, so that wasn't helpful.

STEP 3
I don't know PHP, so opening the code was a last resort. Content.php contains this code:

Code: Select all

	$results = array();
	if(count($rows))
	{
		foreach($rows as $row)
		{
			$new_row = array();
			foreach($row AS $key => $article) {
				if(searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
					$new_row[] = $article;
				}
			}
			$results = array_merge($results, (array) $new_row);
		}
	}
The line throwing the error is this one: if(searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) { which just passes three parameters to the function looking for a True/False to be returned. So it seems that Joomla can't find the function.

STEP 4
I grepped the /public_html directory and located the function in administrator\components\com_search\helpers\search.php:

Code: Select all

	/**
	 * Checks an object for search terms (after stripping fields of HTML)
	 *
	 * @param object The object to check
	 * @param string Search words to check for
	 * @param array List of object variables to check against
	 * @returns boolean True if searchTerm is in object, false otherwise
	 */
	function checkNoHtml($object, $searchTerm, $fields) {
		$searchRegex = array(
				'#<script[^>]*>.*?</script>#si',
				'#<style[^>]*>.*?</style>#si',
				'#<!.*?(--|]])>#si',
				'#<[^>]*>#i'
				);
		$terms = explode(' ', $searchTerm);
		if(empty($fields)) return false;
		foreach($fields AS $field) {
			if(!isset($object->$field)) continue;
			$text = $object->$field;
			foreach($searchRegex As $regex) {
				$text = preg_replace($regex, '', $text);
			}
			foreach($terms AS $term) {
				if(JString::stristr($text, $term) !== false) {
					return true;
				}
			}
		}
		return false;
	}
All I can tell here is that this function takes three parameters; three parameters were passed by content.php so that looks right. So I can find the function, but Joomla can't.

CONCLUSION - BUG?
I'm left thinking that I need to somehow tell Joomla about this file so it can find the function, but am uncertain how to do that as I've only been messing with Joomla a few weeks and do not understand it's architecture yet.

I'm also not sure if this is something to do with my installation, perhaps something missing in an ini file, or if it's a bug in Joomla 1.5.6 itself.

Any assistance would be much appreciated. Thank you.

jpatti
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Sun Aug 03, 2008 6:05 am

Re: problem with search: error on checkNoHTML

Post by jpatti » Mon Aug 18, 2008 5:07 am

Like everyone else who posts with a problem, I'm anxious for a reply. For now, I unpublished the search functionality, but that's not a good solution.

I'm not sure if this is a bug and I should've posted in one of the developer forums. Perhaps it was just too advanced for the users forums?

If anyone has advice for me about where is most appropriate for me to post this question, I'd appreciate it.
Thanks.

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Mon Aug 25, 2008 4:03 pm

Hi,
Same thing happen in my website after upgraded patches to 1.5.6 and nobody come out with solution even the developer.

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Mon Aug 25, 2008 6:05 pm

I have the same problem and I am in the process of coming up with a possible patch. I am certainly going to post it here. Have any of you informed this to the bug-squad?

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Mon Aug 25, 2008 6:13 pm

I'm not so sure if anyone had reported this problem to the bug-squad . TQ for your initiative ...

jpatti
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Sun Aug 03, 2008 6:05 am

Re: problem with search: error on checkNoHTML

Post by jpatti » Tue Aug 26, 2008 12:03 am

No, I did not report this as a bug. Frankly, I'm new enough to Joomla that I was uncertain if it was a bug or something stupid I was doing.

That I didn't find anyone else complaining about this problem when I searched made me think it was some obvious configuration thing everyone but me knew about, that my question was the equivalent of asking how to get rid of the "welcome to the home page" message.

I'm also new enough to have no idea how to report bugs yet.

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Tue Aug 26, 2008 2:24 am

Well, I am fairly new to joomla too but have done enough programming to understand most of the framework. I believe that I have a solution but need to test it before giving it out. I am not sure that this a bug yet. Maybe we are doing something wrong. However,it started to happen once I upgraded to 1.5.6.

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Tue Aug 26, 2008 2:32 am

You're absolutely right ediaz....this thing happen after upgraded patch to 1.5.6 and i dont think this was due to stupid thing done by joomla user.

To Jpatti,
have u solved your problem on how to get rid of the 'Welcome to the homepage' message?

TQ

cwatson35
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Oct 30, 2007 10:04 pm

Re: problem with search: error on checkNoHTML

Post by cwatson35 » Tue Aug 26, 2008 3:10 am

I had the same problem and fixed it by re-uploading the 1.5.3 to 1.5.6 patch. I only uploaded the /administrator/component/com_search files and directories. For some reason these got missed when I first applied the patch. :eek:

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Tue Aug 26, 2008 3:20 am

Humm...I kept digging and found that the function was added in the patch files used to go from version 1.5.4 to 1.5.5. So it was introduced before 1.5.6. Sorry, my mistake.

This means that I had done something in my programming that did not catch this new function. This may be because I copy and enhanced the search function for something very specific. Will keep you posted as to what I find finally and what we can do to solve this.

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Tue Aug 26, 2008 4:29 am

I think I found what is causing the error, at least in the programming that I am doing.

Make sure that in line 34 of .../components/com_search/views/search/view.html.php you have the following line:

require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'search.php' );.

This line will tell the search component where to find the helper file where the checkNoHTML resides.

In my case, I remembered changing this line as part of some programming that I was doing. Hence, this is why I got the same error as you. However, I am not sure why or what has gone wrong with your installation.

I am pretty sure that this will solved it though. Let me know.

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Tue Aug 26, 2008 6:19 am

ok..i will try put this command line as mention...TQ

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Tue Aug 26, 2008 3:35 pm

I have put the command line but still get an error msg as below
Fatal error: Call to undefined method SearchHelper::checknohtml() in /mnt/new_home/mysite/public_html/plugins/search/content.php on line 253

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Tue Aug 26, 2008 3:48 pm

Hi all,
I have done with my own trial and it was succesful.
Just extract the Joomla_1.5.6-Stable-Full_Package into tmp folder and copy all the following folder to the same destination on the server

1.folder > \components\com_search
2.folder > \administrator\components\com_search

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Tue Aug 26, 2008 10:10 pm

Yes, that will do it! I forgot that you also had to make sure that the search component in the administrator directory needs to be updated to the latest version which is what you just did. Great! We can consider this problem closed.

jpatti
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Sun Aug 03, 2008 6:05 am

Re: problem with search: error on checkNoHTML

Post by jpatti » Fri Aug 29, 2008 12:30 pm

I had tried overwriting my installation with the full download back in my first post to this thread (see step 1).

Tonight, I did a backup of both the site itself and the database first, then downloaded the 1.5.6 full package again, and just FTP'd up the directories mentioned above. Turned back on the search module and menu item and it works! I assume some file *didn't* get copied when I FTP'd it before. Who knows?

All I know for sure is I've got a search function again! Thanks guys.

P.S. Yes, I got rid of the Welcome to the Front Page! ;)

P.S.S. And yes, I am a programmer too, and PHP looks like a pretty straightforward language, but... I've got about half an idea of what the various bits of Joomla do, trying to figure out which bits use which other bits is a bit over my head so far. In short, too many bits! ;)

I appreciate all the help!

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Fri Aug 29, 2008 3:30 pm

Jpatti,
The problem was not due to some file didnt get copied when you uploaded before...but i think this problem is due to update patche made by joomla was not fully complete.

JoeBackward
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Wed May 30, 2007 1:48 am

Re: problem with search: error on checkNoHTML

Post by JoeBackward » Thu Sep 04, 2008 1:47 pm

You guys rock! Thanks for the fix!

User avatar
masamedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Tue Sep 09, 2008 11:47 am

Re: problem with search: error on checkNoHTML

Post by masamedia » Sat Sep 13, 2008 2:35 pm

I confess, I am not sure what the solution is for me. I am running 1.5.7 now, the error message I get is almost the same - almost ;-)
Fatal error: Undefined class name 'searchhelper' in /[path to Joomla]/plugins/search/content.php on line 253
Do I need to copy from the 1.5.6 Full Stable oder 1.5.7 Full Stable package?
(Previously I updated from 1.5.6 to 1.5.7).

thanks in advance,
masa

faridkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Jun 06, 2008 4:29 pm

Re: problem with search: error on checkNoHTML

Post by faridkl » Sat Sep 13, 2008 6:39 pm

Try to extract Joomla1.5.7 Full Stable package into any temp folder. And by using FTP application, login to your account
Just follow the below instruction by copy all the file in the following folder into the same destination on the server

1.folder > \components\com_search
2.folder > \administrator\components\com_search

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Sat Sep 13, 2008 7:03 pm

It looks that you have a different situation for the error is generated from a plugin. I am going to do some research and get back to you. Let us know if it get fix by just re-installing the files for 1.5.7.

User avatar
masamedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Tue Sep 09, 2008 11:47 am

Re: problem with search: error on checkNoHTML

Post by masamedia » Sat Sep 13, 2008 9:51 pm

ediaz, exactly. The more, after having copied the files from the "full package", I got an error message when accessing "Menu -> Components -> Search". Shame on me, I don't have any copy of this error message. Then I copied back the backup, resp. the old files to the admin directory-

regardless, I am (still) getting this error message:
Fatal error: Undefined class name 'searchhelper' in /[path to Joomla]/plugins/search/content.php on line 253

User avatar
ediaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sun Jan 29, 2006 11:37 pm
Location: Puerto Rico
Contact:

Re: problem with search: error on checkNoHTML

Post by ediaz » Sat Sep 13, 2008 10:56 pm

I looked into this very briefly and here are some hints.

Check that you have the following code:

"require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php');"

in line #50 located in [path to Joomla]/plugins/search/content.php.

This tell the plug-in where to find the "SearchHelper" class.

If you have this line in the plugin, then check that the following file exist:

[path to Joomla]/administrator/components/com_search/helper/search.php.

If you do have this file, get in it and check that the method being called from the plug-in is there, i.e. "checkNoHtml".

If you do not see it, make sure that you replace that file with the most recent one which I believe its located in update patch 1.5.4 ->1.5.5.

Maddex
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Thu Apr 05, 2007 7:19 am

Re: problem with search: error on checkNoHTML

Post by Maddex » Thu Sep 18, 2008 10:26 am

I had the same problem after upgrading to 1.5.7 by patching (1.5.6_to_1.5.7), but I managed to solve it.

My solution was to get this file from the Joomla Stable Full Package 1.5.7:
administrator/components/com_search/helpers/search.php
and then upload it via ftp to its place on the server.

Then the search component started to work again.

I think this file was ment to be integrated in the patch, but is not by mistake.

/ Madde

folsom
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed May 28, 2008 7:23 pm

Re: problem with search: error on checkNoHTML

Post by folsom » Mon Sep 22, 2008 4:21 pm

faridkl wrote:Hi all,
I have done with my own trial and it was succesful.
Just extract the Joomla_1.5.6-Stable-Full_Package into tmp folder and copy all the following folder to the same destination on the server

1.folder > \components\com_search
2.folder > \administrator\components\com_search
I was having this same issue and this solution worked perfect for me. Thanks guys for your hard work and research into fixing this problem.

Josh

User avatar
prdg1
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Wed Jun 25, 2008 3:38 pm
Location: Plano, Texas, USA
Contact:

Re: problem with search: error on checkNoHTML

Post by prdg1 » Wed Oct 08, 2008 6:35 pm

folsom wrote:
faridkl wrote:Hi all,
I have done with my own trial and it was succesful.
Just extract the Joomla_1.5.6-Stable-Full_Package into tmp folder and copy all the following folder to the same destination on the server

1.folder > \components\com_search
2.folder > \administrator\components\com_search
I was having this same issue and this solution worked perfect for me. Thanks guys for your hard work and research into fixing this problem.

Josh
This worked for me also. I actually just uploaded all the files from the search in both folders and it fixed my problem. BTW - does anyone know for sure if this has been reported so they can fix it in the next upgrade?
Patsy Gillispie
Designer/Developer - Dallas, Texas
Visit my site: http://www.gogreencre8tive.com

aspiretojoomla
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jul 01, 2008 12:03 am
Location: Gainesville, Florida
Contact:

Re: problem with search: error on checkNoHTML

Post by aspiretojoomla » Mon Oct 27, 2008 12:51 am

prdg1 is 100% correct.
I have verified this, as well as now know what's going on.

The Joomla_1.5.6_to_1.5.7-Stable-Patch_Package.zip that came from Joomla, as well as the one that GoDaddy and WebhostingBuzz both applied to customer Joomla installations recently, are all completely missing any /administrator/components/com_search FILES AT ALL!!! :eek:

So, two things need to happen here if you are also affected in this way:

1. Joomla! needs to include the administrator/components/com_search folder/files in the FULL PACKAGE patch (Joomla_1.5.7-Stable-Full_Package.zip), then redeploy the Joomla_1.5.6_to_1.5.7-Stable-Patch_Package.zip; :-[

2. For any of you having this issue that began when you upgraded your Joomla! site, or your ISP/webhost did for you - you will just need to
-Download the Joomla_1.5.7-Stable-Full_Package.zip
-Extract it to a folder on your PC or Mac
-Copy up (via FTP or other method) to your site the two following folders and their contents:

-----/administrator/components/com_search
-----/components/com_search

Remember, do this FROM the FULL PACKAGE (Joomla_1.5.7-Stable-Full_Package.zip), and upload to your site into the same locations.

I did :geek:, and now com_search is working perfectly again :D just as it was before the half-baked patch broke it! :eek:

Enjoy.

joope
Joomla! Explorer
Joomla! Explorer
Posts: 302
Joined: Mon Sep 15, 2008 11:07 am

Re: problem with search: error on checkNoHTML

Post by joope » Tue Feb 03, 2009 2:28 pm

THANKS GUYS...IT FIXED MY ISSUES WITH MY SEARCH MODULE...JUST BY UPDATING MY COM_SEARCH FOLDERS

5lownotes
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Dec 08, 2008 6:01 am

Re: problem with search: error on checkNoHTML

Post by 5lownotes » Sat Feb 28, 2009 7:25 am

I am running a 1.5.8 install from an update and FTP'ing these files from a full stable install to their respective equals on the server fixed the issue for me as well.

-----/administrator/components/com_search
-----/components/com_search

But it seems that the same mistake was made with the 1.5.7 to 1.5.8 update!
I am glad I have development sites to check for bugs like these before I go live.... :)

User avatar
weting
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 103
Joined: Sun Nov 25, 2007 9:10 am
Location: Aspudden, Stockholm

Re: problem with search: error on checkNoHTML

Post by weting » Wed Feb 17, 2010 11:31 am

I got the same problem and solved it the same way by overwriting the search folder with a new one. Thanks for the solution.
Det finns en mening med allt som sker...


Locked

Return to “Administration 1.5”