J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Phoca Guestbook - creating guestbooks in Joomla! CMS
Kharlanki
Phoca Member
Phoca Member
Posts: 19
Joined: 02 Aug 2010, 14:48

J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Kharlanki »

Hi,

J!2.5.6
PHP 5.3.14
phoca GuestBook 2.0.5

If I switch from PHP 5.2.17 to 5.3.x I'll get no TTF Captcha. If I browse manually to the mage URL, I get this error:

Code: Select all

Warning: mt_rand() [function.mt-rand]: max(50) is smaller than min(52) in /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php on line 82

Warning: mt_rand() [function.mt-rand]: max(125) is smaller than min(126) in /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php on line 82

Warning: mt_rand() [function.mt-rand]: max(162) is smaller than min(163) in /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php on line 82

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /home/xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /home/xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /home/xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /home/xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/components/com_phocaguestbook/helpers/phocaguestbookcaptcha.php:82) in /home/xxx/components/com_phocaguestbook/views/guestbooki/tmpl/default.php on line 8
With PHP 5.2.17 or 5.4.14 it works fine...
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Jan »

Hi, will do some tests.

Please try to do this:

Go to file components\com_phocaguestbook\helpers\phocaguestbookcaptcha.php

and replace this function (cca line 79)

FROM:

Code: Select all

function getRandomPositionX($i) {
		$rand_2 = mt_rand(-2,3);
		$rand_3 = $i + ($rand_2);
		$rand 	= mt_rand($i,$rand_3);
		return $rand;
	}
TO:

Code: Select all

function getRandomPositionX($i) {
		$rand_2 = mt_rand(-2,3);
		$rand_3 = $i + ($rand_2);
		
		if ((int)$i > $rand_3) {
			$rand 	= mt_rand($rand_3, $i);
		} else {
			$rand 	= mt_rand($i,$rand_3);
		}
		return $rand;
	}
and let me know.

Thank you, Jan
Jan
If you find Phoca extensions useful, please support the project
Kharlanki
Phoca Member
Phoca Member
Posts: 19
Joined: 02 Aug 2010, 14:48

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Kharlanki »

Yay, that works! :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Jan »

Great to hear it, I will set it for next release.

Jan
If you find Phoca extensions useful, please support the project
ChOpSueY!
Phoca Member
Phoca Member
Posts: 17
Joined: 08 Jul 2008, 15:18

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by ChOpSueY! »

This is not working to me Jan, still the problems.
ChOpSueY!
Phoca Member
Phoca Member
Posts: 17
Joined: 08 Jul 2008, 15:18

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by ChOpSueY! »

Hey Jan,
can I expect any help for this? I need to figure it out or else i have to search for alternatives. The guestbook has no funtion like this. Hope you can help.

Best regards,
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Jan »

Hi, testing now without any problem, do you get some error message after making the change? (listed above)?
If you find Phoca extensions useful, please support the project
ChOpSueY!
Phoca Member
Phoca Member
Posts: 17
Joined: 08 Jul 2008, 15:18

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by ChOpSueY! »

Hi Jan,
it simply has no effect. I have altered it the way you said in your post above. There is still no captcha, simply "Sicherheitsabfrage". The error massage when you try to view the captcha is:

Fatal error: Call to a member function get() on a non-object in D:\FTP_Root\LocalUser\usr_helmscheid\components\com_phocaguestbook\views\guestbooki\tmpl\default.php on line 37

Best regards,
Martin
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: J!2.5.6 + PHP 5.3.14 + GB 2.0.5 = no TTF Captcha

Post by Jan »

Hi, really not sure what did you modify there, but in original there is no such line :-( :idea:

Jan
If you find Phoca extensions useful, please support the project
Post Reply