Index: sites/all/modules/fivestar/includes/fivestar.field.inc
===================================================================
--- sites/all/modules/fivestar/includes/fivestar.field.inc	(revision )
+++ sites/all/modules/fivestar/includes/fivestar.field.inc	(revision )
@@ -71,20 +71,20 @@
       '#type' => 'fieldset',
       '#title' => t('Voting target PHP code'),
       '#collapsible' => TRUE,
-      '#collapsed' => empty($field['php_target']),
+      '#collapsed' => empty($field['settings']['php_target']),
     );
 
     $form['php_target']['php_target'] = array(
       '#title' => t('Code'),
       '#type' => 'textarea',
-      '#default_value' => isset($field['settings']['php_target']) ? $field['settings']['php_target'] : '',
+      '#default_value' => isset($field['settings']['php_target']['php_target']) ? $field['settings']['php_target']['php_target'] : '',
       '#description' => t('Advanced usage only: PHP code that returns a target node ID. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the value returned by this code will override any value specified above. Note that executing incorrect PHP-code can break your Drupal site.'),
     );
   }
   else {
     $form['php_target'] = array(
       '#type' => 'value',
-      '#value' => isset($field['settings']['php_target']) ? $field['settings']['php_target'] : '',
+      '#value' => isset($field['settings']['php_target']['php_target']) ? $field['settings']['php_target']['php_target'] : '',
     );
   }
 
@@ -151,7 +151,7 @@
     $items[$delta]['target'] = fivestar_field_target($object, $field, $item);
 
     if (is_numeric($items[$delta]['target'])) {
-      _fivestar_cast_vote('node', $items[$delta]['target'], $rating, $field['axis'], $node->uid, FALSE, TRUE);
+      _fivestar_cast_vote('node', $items[$delta]['target'], $rating, $field['axis'], $object->uid, FALSE, TRUE);
       votingapi_recalculate_results('node', $items[$delta]['target']);
     }
   }
@@ -163,9 +163,9 @@
 function fivestar_field_target($node, $field, $item) {
   $target = FALSE;
 
-  if (!empty($field['settings']['php_target'])) {
+  if (!empty($field['settings']['php_target']) && !empty($field['settings']['php_target']['php_target'])) {
     // Use eval rather than drupal_eval to allow access to local variables.
-    $target = eval($field['settings']['php_target']);
+    $target = eval($field['settings']['php_target']['php_target']);
   }
   elseif (!empty($field['settings']['dynamic_target']) && !empty($node->$field['dynamic_target'])) {
     if (is_array($node->$field['dynamic_target']) && is_numeric($node->{$field['dynamic_target']}[0]['nid'])) {
