Captcha Image missing

Chas_L 30 May, 2017
Hi, Have just updated Chronoforms V5 on my site to version 5.0.15. Now the simple captcha image does not show. See attached. It was working perfectly before this update. The only other change is an upgrade of PHP on the server to v7.1.5, previously it was on PHP v5.6

Test form here: http://chas-large.co.uk/index.php?option=com_chronoforms5&chronoform=demo-basic-contact-captcha

Creating another test form using ReCapture has the same issue, no image.

http://chas-large.co.uk/index.php?option=com_chronoforms5&chronoform=demo-basic-contact-recaptcha

So I thought I'd follow your guide to possibly upgrade to Chronoforms v6. I installed all but the TCP plugin and went to set up a new form in the v6 interface. However, any form created then saved generates the following error message:

0 Call to undefined function G2\L\mb_convert_encoding()

So I can't use v6.

Any ideas?

Chas.
Chas_L 30 May, 2017
Thanks Prof, (even a Robot needs a thank you) the first item is out of date as I don't have the options shown.

Testing other settings and changes failed to fix.

Changing the PHP on the server back to v5.6 resolved the issue, so I can only assume there is some code in Chronoforms that is not PHP 7.1 compatible. For now I'll leave it as 7.1 as I need to use another module that requires PHP 7.

Similarly, switching PHP back to v5.6 also makes Chronoforms v6 work correctly.

Perhaps the dev can specify what version of PHP Chronoforms is supposed to work with and if V7 and above is listed, are there any PHP extensions it requires, they may not have been enabled on my server.

Thanks for your help.

Chas
Chas_L 31 May, 2017
The second option to enable 'informative' error reports is no longer valid as there is no components/com_chronoforms/chrono_verification.php in either v5 or v6.

It would be useful though if I could see these errors. Is there some other way?

Chas.
GreyHead 31 May, 2017
Hi Chas,

The error message appears to be because the PHP Multi-Byte string library is not installed on your server. Adding this should solve the display problem.

If that is not simple to do then it might be easier to switch to using Google ReCaptcha instead.

Bob
Chas_L 31 May, 2017
Hi Bob,

I have a VPS and have installed and enabled PHP Multi-Byte but it has not fixed the issue. I have a PHP Info in the root of the site if you want to check it.

I already used the Google Recaptcha, which is in the second link I gave above using your demo form. I assumed that selecting the demo form with Recaptcha in the title, it would pick up the Google Recaptcha function.

A normal contact form does, which I have tested. So I know Recaptcha is working.

Can you suggest anything else please?

Thanks
Chas
GreyHead 31 May, 2017
Hi Chas,

The root php.info can be misleading - please check the settings in the Site Admin > System Info > PHP Info page

Best wishes

Bob
Chas_L 31 May, 2017
Thanks Bob,

It shows as enabled there too. See attached.

Chas.
GreyHead 31 May, 2017
Hi Chas,

If you can, please try this: edit the file /libraries/cegcore2/libs/str.php and around line 124 add the \s shown here
	//generate slug of a string
	public static function slug($str, $limiter = '-', $unicode = false){
		$pattern = $unicode ? '/[^\pL\pN-]+/u' : '/[^A-Za-z0-9'.$limiter.']+/';
		$str = \mb_convert_encoding((string)$str, 'UTF-8', \mb_list_encodings()); // << two here
		$str = str_replace(array("'", '"'), '', $str);
		$str = preg_replace($pattern, $limiter, $str);
		$str = preg_replace('/['.$limiter.']+/', $limiter, $str);
		$str = str_replace($limiter.$limiter, $limiter, $str);
		$str = trim($str, $limiter);
		return \mb_strtolower($str, 'UTF-8'); // << one  here
	}
The \s identify those functions as being in the root namespace instead of the CH G2\L\ namespace - not sure why that might be needed but worth a quick test.

Bob
Chas_L 31 May, 2017
Hi Bob

My code is slightly different:

 
	//generate slug of a string
	public static function slug($str, $limiter = '-'){
		$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings());
		$str = str_replace(array("'", "-", '"'), '', $str);
		$str = preg_replace('/[^A-Za-z0-9-]+/', $limiter, $str);;
		$str = str_replace($limiter.$limiter, $limiter, $str);
		$str = trim($str, $limiter);
		return mb_strtolower($str, 'UTF-8');
	}
 


But replacing all of mine with all of yours didn't fix it.

Maybe my library is out of date? Though I am running Joomla 3.7.2 and would assume that has the latest?

EDIT: Changing back to my code and adding the \ before the 3 mb_... entries still didn't fix the issue.

Chas.
Chas_L 31 May, 2017
Hi Bob,

Apologies, I misread the directory, I was looking at the cegcore directory not the cegcore2. My code here is again, slightly different to yours:

 
	//generate slug of a string
	public static function slug($str, $limiter = '-', $unicode = false){
		$pattern = $unicode ? '/[^\pL\pN-]+/u' : '/[^A-Za-z0-9'.$limiter.']+/';
		$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings());
		$str = str_replace(array("'", '"'), '', $str);
		$str = preg_replace($pattern, $limiter, $str);
		if(!empty($limiter)){
			$str = preg_replace('/['.$limiter.']+/', $limiter, $str);
		}
		$str = str_replace($limiter.$limiter, $limiter, $str);
		$str = trim($str, $limiter);
		return mb_strtolower($str, 'UTF-8');
	}


I have an extra IF statement half way down.

However, editing the code in the str.php file adding the extra back slashes, again does not render the image. Nore does putting your whole block in place of mine, so back to you my friend.

Chas.
Chas_L 01 Jun, 2017
Hi Bob,

Further to the PM I sent you, I decided to go through each PHP module to see what they did in 5.6 and to see if I could identify one which might have an effect. I found the php-gd graphics library was needed and after install, the standard captcha image now works correctly.

However, the Google ReCaptcha form still just shows {ReCaptcha} where the code display should be. Maybe it needs the tweaking your FAQ suggests?

Chas.
GreyHead 01 Jun, 2017
Hi Chas,

I'm at a loss :-( I see no problems with this on PHP 7,0 (my webhost doesn't yet offer 7,1). The message you are seeing suggests that the mb_convert_encoding() function is not available. I can't see why that would be if the mb library is installed. I have checked the PHP 7.1 upgrade docs and don't see any likely explanation there.

Bob

PS Sorry for not having updated my version of the file :-(
Chas_L 01 Jun, 2017
Hi Bob,
I don't have an MB_CONVERT_ENCODING() option in either 5.6 or 7.1. I just switched back to 5.6 to check the ReCaptcha function on the demo form and it's not working there either, still just {ReCaptcha} shown. Which is strange, because I'm sure it worked before.

Looking at my VPS PHP section, I cannot see an option to install mb_convert_encoding() So I guess I'll have to find out how to install it. You're sure you have that on your host's PHP module list?

EDIT: Odd too that ReCaptch works OK with the standard Joomla Contact Form, so begs the question, is this really needed??

Chas.
Chas_L 01 Jun, 2017
Hi Bob,
did some research and that function would be part of the mb_string. If mb_convert_encoding was missing, an error

Fatal error: Call to undefined function mb_convert_encoding()

Would be seen and none is

I've gone ahead and installed all the other PHP modules that were not previously in 7.1 but were in 5.6 and it has again, not fixed this, so it gets stranger still?

Chas.

PS, your RoxBox video display on the website FAQ is not working:
http://www.chronoengine.com/faqs/55-cfv4/cfv4-anti-spam/2595-how-do-i-add-a-recaptcha-to-my-form.html
Chas_L 01 Jun, 2017
Bob, sussed it.

The Demo ReCaptcha form had the Load Captcha and Check Captcha events installed. Changing these to the Load ReCaptcha and Check ReCaptcha as per your video here:https://www.youtube.com/watch?v=MKAigQgYaEs has now got me a working ReCaptcha form.

Phew!!!

Chas.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger