CMS MADE SIMPLE FORGE

Guestbook

 

[#9452] multiple "Notice: Undefined index: " errors in class.GuestbookFrontend.php

avatar
Created By: Twan Wintjes (twazerty)
Date Submitted: Sat Aug 03 09:49:28 -0400 2013

Assigned To:
Version: 1.4_RC2
CMSMS Version: 1.11.7
Severity: Critical
Resolution: None
State: Open
Summary:
multiple "Notice: Undefined index: " errors in class.GuestbookFrontend.php
Detailed Description:
After upgrading to CMSMS 1.11.7 I am getting multiple errors:

Notice: Undefined index: show_entry in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 124

Notice: Undefined index: showaddform in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 579

Notice: Undefined index: hide_insertbutton_after_post in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 580

Notice: Undefined index: show_entry in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 124

Notice: Undefined index: sortasc in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 841

Notice: Undefined index: sortasc in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 847

And after adding a message even more:

Notice: Undefined index: timespan in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 478

Notice: Undefined index: sender_email in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 505

Notice: Undefined index: shownow in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 361



Solution is very easy. Check all incoming parameters with isset:

from:
if ($params['show_entry'] != '')
{
        $mode = 'entry';
}

to:
if (isset($params['show_entry']))
{
        $mode = 'entry';
}

from:
$this->SetHideInsertButtonAfterPost($params['hide_insertbutton_after_post'] ==
'1' ? true : false);

to:
$this->SetHideInsertButtonAfterPost((isset($params['hide_insertbutton_after_post'])
&& $params['hide_insertbutton_after_post']) == '1' ? true : false);

etc

If a add all parameters there are no errors:
{cms_module module='Guestbook' smiley='0' shownow='1' captcha='0' sortasc='0'
show_entry='' showaddform='0' hide_insertbutton_after_post='0' timespan='60'}

but then it will fail in the search results. So better to fix it in the source
:)

If you add me as developer to the project I will fix it and check it in.


History

Comments
avatar
Date: 2013-11-24 19:32
Posted By: Dominik Lenné (dlen)

I can confirm this behaviour for cmsms v 1.11.9.
      
avatar
Date: 2015-05-26 22:32
Posted By: jackets (jackets)

thank you for your share http://www.secondnaturecanvas.com/