While working on #361446: missing list of signup users inside node which makes nice use of the whole "extra fields" API in CCK to drag + drop signup info to control where on the node it is displayed, I ran into a bug in content_extra_field_weight(). It's a pretty small function:
function content_extra_field_weight($type_name, $pseudo_field_name) {
$type = content_types($type_name);
// If we don't have the requested item, this may be because the cached
// information for 'extra' fields hasn't been refreshed yet.
if (!isset($type['extra'][$pseudo_field_name])) {
content_clear_type_cache();
}
if (isset($type['extra'][$pseudo_field_name])) {
return $type['extra'][$pseudo_field_name]['weight'];
}
}
The problem is that if we hit the case where we need to call content_clear_type_cache(), we leave $type with the same uninitialized values, test it again immediately thereafter, (no surprise) the weight is still undefined, so we return NULL.
The solution is trivial, after we clear the cache, we need to refresh $type...
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 363456_content_extra_field_weight.1.patch | 654 bytes | dww |
Comments
Comment #1
dwwPatch applies cleanly to either DRUPAL-6--2-1 or the end of DRUPAL-6--2.
Comment #2
yched commentedRight, committed to D6 branch. Thanks !
This area has changed quite a bit in D7 (and might still change in the future, for that matter). Not sure if and how this should be foreported.
Moving to D7 as a reminder.
Comment #3
andypostis this issue still active?
Comment #4
karens commentedThis code is in core in D7, nothing to do here.