CMS MADE SIMPLE FORGE

CGFeedback

 

[#12036] PHP warning when using more than one field

avatar
Created By: Chris Taylor (chrisbt)
Date Submitted: Tue May 07 10:47:06 -0400 2019

Assigned To: Robert Campbell (calguy1000)
Version: 2.2.1
CMSMS Version: 2.2.10
Severity: None
Resolution: None
State: Open
Summary:
PHP warning when using more than one field
Detailed Description:
A php warning is generated when using more than 1 field and 1 or more fields are
empty.
when using:
{$fields=$one->get_field_hash()}

[07-May-2019 14:01:23 UTC] PHP Notice:  Undefined offset: 2 in
/home/dev/public_html/coomber-dev/modules/CGFeedback/lib/class.comment.php on
line 113


fixed in CGFeedback/lib/class.comment.php in line 111, by replacing:
        foreach( $fielddefs as $fid => $rec ) {
            $name = $rec['name'];
            $out[$name] = $this->_fields[$fid];
        }

with:
        foreach( $fielddefs as $fid => $rec ) {
            $name = $rec['name'];
            if ( isset($this->_fields[$fid]) ) {
               $out[$name] = $this->_fields[$fid];
            }
        }



History