HI

Im getting the

error Undefined index: und in __lambda_func() (line 3 /sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(202) : runtime-created function).

line 3 is /** so not sure what the cause is.

any help would be appreciated

Comments

bavramor’s picture

I got the same issue with this code:

 $node = node_load($data->nid);
$var1 = $node->body['und'][0]['value'];
$var2 = $node->field_bilder_f_r_die_galerie_2['und'][0]['value'] ;
if((!empty($var1)) || (isset($var2))){
echo "link";
}
else{
}
var_dump($var1);
var_dump($var2);

Error notice:

Notice: Undefined index: und in __lambda_func() (Zeile 3 von /home/bavramor/data/Webdesign/Webseiten/feuerwehr-germendorf/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(198) : runtime-created function).
Notice: Undefined index: und in __lambda_func() (Zeile 2 von /home/bavramor/data/Webdesign/Webseiten/feuerwehr-germendorf/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(198) : runtime-created function).

tested with :

7.x-1.0-alpha1
7.x-1.x-dev

any help would be appreciated

johnv’s picture

Category: Bug report » Support request

This is an error in your own code.
1. You can inspect the available data with devel module enabled: dpm($node);
2. Perhaps the field has no value yet, so do a $var1 = isset($node->body['und'][0]['value']) ? $node->body['und'][0]['value'] : '';.

3. go the fancy way with Entity Metadata Wrappers (I think you must enable the Entity module first):

$wrapper = entity_metadata_wrapper('node', $node);
$var1 = $node->body->value();
Liam Morland’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.