Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Upon viewing a node that has no taxonomy fields, I get this error:
Fatal error: Cannot access empty property in /Users/nate/Sites/grammy4/docroot/modules/field/field.module on line 936
This is because smartqueue.module uses field_get_items() in smartqueue_taxonomy_nodequeue_subqueues(). It's this bit that causes the problem:
// Check if at least one supported field exists in node and load
// selected tids.
foreach (explode('-', $queue->reference) as $field_name) {
// Save tids.
if ($field_values = field_get_items('node', $node, $field_name)) {
$field_names[$field_name] = array();
foreach ($field_values as $field_value) {
$field_names[$field_name][] = $field_value['tid'];
}
}
}
If you explode() on an empty string, you end up with an array with one empty object in it (e.g. array('')
). This means that field_get_items is called with $field_name = '', which causes the error. This can be fixed simply by using array_filter() to ensure there are no empty items in the resulting exploded array.
Comment | File | Size | Author |
---|---|---|---|
#1 | smartqueue_fatal-1943564.patch | 512 bytes | quicksketch |
Comments
Comment #1
quicksketchComment #3
jenlamptonConfirmed this is still an issue in 7.x-2.x-dev. Patch applies. Running tests again.