Search code examples
phpissetnotice

Undefined index: name in Dataset.php after upgrade to php 5.3


PHP Notice:  Undefined index: parentid in /home/public_html/data/Dataset.php on line 319
PHP Notice:  Undefined index: destinations in /home/public_html/data/Dataset.php on line 330
PHP Notice:  Undefined index: radiogroup in /home/public_html/data/Dataset.php on line 340
PHP Notice:  Undefined index: radiogroup in /home/public_html/data/Dataset.php on line 340
PHP Notice:  Undefined index: radiogroup in /home/public_html/data/Dataset.php on line 340
PHP Notice:  Undefined index: radiogroup in /home/public_html/data/Dataset.php on line 340
PHP Notice:  Undefined index: name in /home/public_html/data/Dataset.php on line 220
PHP Notice:  Undefined index: fieldhelp in /home/public_html/data/Dataset.php on line 236

My script refuses to work after upgrading to php 5.3 from 5.2. I am seeing many PHP Notice in the log.

at line 319: if( $this->aFields["parentid"] ) {

at line 340: if( $curField["radiogroup"] ) {

I suspect the problem is in another file which contains many such lines

 if( isset( $this->request_vars[$name]["id"] ) ) {

how do i fix this? if it's that easy by judging from above.


Solution

  • It's not an error. It says that there's no element with index "radiogroup" etc. in array $curField.

    You have to check if is it present first using isset, for example:

    if(isset($curField['radiogroup']) and $curField['radiogroup']) {