When my anonymous user trying to create content profile during registrarion, he receive WSOD and this PHP Fatal error: Call to undefined function _content_is_empty() in /var/www/apache2/html/sites/all/modules/cck/cck/content.module on line 935

Members fund testing for the Drupal project. Drupal Association Learn more


markus_petrux’s picture

Status: Active » Fixed

it looks like some field in your profile does not have information about the module that implements that field. This could be a bug in content profile.

hook_content_is_empty() should be implemented by the module that implements the field. For example, text_content_is_empty() is implemented by text module, etc.

If this hook does not exist, then the bug is in the module that implements the field.

If this hook exists, but the script where it is implemented is not loaded, then this could be an indication of a bug somewhere in content profile.

This may also happen if someone tries to process a field implemented by a module that has been disabled/uninstalled. This indicates some kind of inconsistency in the database.

Status: Fixed » Closed (fixed)

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

najibx’s picture

I have checked that I have no missing fields (under manage field) for profile content type. but still getting this error. what best to trouble shoot this?


monstordh’s picture

Title: Call to undefined function _content_is_empty() » Same problem but with FUpload module

I'm having the same issue but it's related to CCK fields and the Image FUpload module. It happens when I am redirected to edit the captions for the images. I don't have Captions enabled, so this may be the issue.

markus_petrux’s picture

Title: Same problem but with FUpload module » Call to undefined function _content_is_empty()

@monstordh: Please, open a separate report in the FUpload module.

Please, refer to #1 to see why this error may happen.

lefnire’s picture

same issue -- didn't show until I switch from 6.x-2.5 to 6.x-3.x-dev.

Of interest is that I checked "Use on Registration" on my content_profile node-type (Volunteer). Previously all the fields would show on registration (first name, last name, bio, bday, etc)... now only one field (bio) shows, and when I click submit I get that error.

bramface’s picture

I got the same fatal error creating nodes through UC_Node_Checkout. It's on a shared server (LunarPages). On my development server, I did not get the error.
However, I made it go away by deleting the "email address" field I had added to the content types in question.


Cristhian’s picture

ccshannon’s picture

@monstordh: I am having the same problem trying to get FUpload working. I checked if you posted an issue in Image FUpload queue, but didn't find anything related to this. I created an issue for this problem, if you can add any information. Thanks.

#623342: Blank screen when hitting 'Done Editing' (CCK3)

skybow’s picture

Status: Closed (fixed) » Needs review
864 bytes

Funny enough, I once ran into this issue with the Content Profile's User referenced in #8, now I run into this issue again with Image FUpload as described in #4.

Apart from the fact, that Image FUpload may have some problems of its own, I try to figure out, why it is a necessity to provide a $form in content_multiple_value_nodeapi_validate although node_validate allows to not specify the $form: (Prototype was taken from api.drupal.org)

function node_validate($node, $form = array())

Shouldn't the code in content_multiple_value_nodeapi_validate be robust against not specifying a $form or not containing all the field info that content_multiple_value_nodeapi_validate expects?

I changed the lines in content.node_form.inc around line 364 and the error in Image FUpload vanished.

  // Filter out items flagged for removal.
  if ($field) {
    $items = content_set_empty($field, $items);

The patch provided is against CCK-3-dev as of 3/3/2010

dpalmer’s picture

Hi Skybow, I'm experiencing the same issue on one of my sites after upgrading from Drupal 5 to 6. I tried applying your patch but I get this error:

1 out of 1 hunk FAILED -- saving rejects to file includes/content.node_form.inc.rej

I really need to get this back up and running so my users can create nodes, any help would be greatly appreciated.

skybow’s picture

Sounds as if you have problems applying the patch? Which version of CCK do you use?
The patch is targeted against the latest CCK 3 developer branch which is not directly available on the main CCK project page.

dpalmer’s picture

Skybow, I was using CCK 2.x. It turns out the issue I experienced was due to forgetting 1 of the steps when upgrading from Drupal 5 to 6...I forgot to update CCK to the latest drupal 5.x version before upgrading drupal, so it was my bad ha. I ended up fixing it by reverting to that 5.x DB, re-performed the upgrade properly and now I am able to save nodes again. :D

Thanks for your help anyways.


wayfarer_boy’s picture

Thanks for the patch, skybow. I was experiencing this problem with CCK-3-dev (June release) and Content Profile 6.x-1.x-dev when adding new users (may have also been on new user registration form, didn't check). Your patch worked with no errors, and now the _content_is_empty() error does not appear (users can now register).

No subsequent issues found, but will report back if suspicious things start to happen! Thanks again.

design.er’s picture

Thank you very much for the patch, skybow. It fixed my WSOD problem with the Image FUpload module after hitting "Done Editing"... and also automatically fixed this issue: #473602: Uploaded CCK image thumbnails don't appear after "Next step".
Awesome... you made my day! :)

dspring0021’s picture

I'm running CCK3 and tried to apply the patch and got a 'Hunk #1 FAILED at 361' as well.

Oops...submitted too soon. Tried to patch in the wrong directory. Seems to be working fine thus far. Thanks!

markus_petrux’s picture

Category: bug » support
Status: Needs review » Fixed

@skybow #10: While node_validate() could be invoked without a $form, the function your are patching will always get a $field, unless something odd happens with internal CCK data about fields. Let's see:

  • function content_multiple_value_nodeapi_validate(&$node, $field, &$items, $form) {
      $field_name = $field['field_name'];
      // Getting the field structure from the form allows other modules alter
      // field properties such as the required attribute.
      $field = $form['#field_info'][$field_name];
      // Get rid of the add more items element.
      unset($items[$field_name .'_add_more']);
      // Reorder items to account for drag-n-drop reordering.
      $items = _content_sort_items($field, $items);
      // Create a copy of the items before filtering those that are flagged
      // for removal. We need this copy later to obtain the error element.
      $items_copy = $items;
      // Filter out items flagged for removal.
      $items = content_set_empty($field, $items);

    Patch modifies last line like this:

       // Filter out items flagged for removal.
    -  $items = content_set_empty($field, $items);
    +  if ($field) {
    +    $items = content_set_empty($field, $items);
    +  }

    However, $field is also used in that function before that line, which would be wrong if $field can really be evaluated to FALSE.

  • content_multiple_value_nodeapi_validate is invoked by content_field() like this:
        case 'validate':
          // If the field is configured for multiple values and these are handled
          // by content module, we need to filter out items flagged for removal and
          // count non-empty items to enforce field requirement settings.
          if ($field['multiple'] >= 1 && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
            module_load_include('inc', 'content', 'includes/content.node_form');
            // Note that the $teaser argument for nodeapi('validate') is the $form.
            content_multiple_value_nodeapi_validate($node, $field, $items, $teaser);

    Since here we are also assuming $field contains valid data, rather than patching content_multiple_value_nodeapi_validate, we would have to come here to resolve that issue. However, $field is passed to content_field() as an argument, so we have to go up and see who is invoking content_field() during a node_validate() operation.

  • Ok, so content_field() is invoked by _content_field_invoke_default() like this:
    function _content_field_invoke_default($op, &$node, $teaser = NULL, $page = NULL) {
      $type_name = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
      $type = content_types($type_name);
      $field_types = _content_field_types();
      $return = array();
      // The operations involving database queries are better off handled by table
      // rather than by field.
      if (in_array($op, array('load', 'insert', 'update', 'delete', 'delete revision'))) {
        return content_storage($op, $node);
      else {
        foreach ($type['fields'] as $field) {
          $items = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
          $result = content_field($op, $node, $field, $items, $teaser, $page);
          if (is_array($result)) {
            $return = array_merge($return, $result);
          else if (isset($result)) {
            $return[] = $result;
          if (isset($node->$field['field_name'])) {
            $node->$field['field_name'] = $items;
      return $return;

    Ok, here we can see that _content_field_invoke_default() is reading field information based on:

      $type_name = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);

    And now we need to analyze if it is really possible that that sentence sets $type_name with anything that will generate bad data during the next statement:

      $type = content_types($type_name);

    And even in the case that $type is empty there, the foreach loop where content_field() is invoked would do no iteration becasue $type['fields'] would be empty:

        foreach ($type['fields'] as $field) {
          $items = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
          $result = content_field($op, $node, $field, $items, $teaser, $page);

In summary, IMO if CCK has to be patched to add defensive code against bad data, it would have to be done somewhere else, not in content_multiple_value_nodeapi_validate(), but defensive code is not a good solution because it could be hiding something that could be generating unexpected behaviors in any other place, and that could lead to a worst scenario. That's bad practice. When you detect that a data structure is bad, you should debug and fix that, patching to hide errors is a bad idea.

This issue has been reported as a "bug report" against CCK, but that is completely wrong. There is something else odd in the site that needs to be anaylized and fixed. I'm leaving this issue as a "support request" and marked as fixed so it is still visible in the queue for a while.

Status: Fixed » Closed (fixed)

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

yetiman’s picture

Patch still working here (CCK August 26 - 2010) !
Juste before I turn crazy.
First I try to apply the patch in the wrong directory... the good one is cck/includes.


wayfarer_boy’s picture

Status: Closed (fixed) » Needs review

Same problem occurs in the latest 6.x-3.x-dev (Nov 3rd). Luckily Skybow's patch still fixes with no errors.

wayfarer_boy’s picture

Status: Needs review » Fixed

Sorry, didn't read Markus' comment. Marking back to 'fixed'.

Status: Fixed » Closed (fixed)

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

bjsomers’s picture


kyberman’s picture

The same problem with actual dev version. Patch (now it's line 365) provisionally helped.

guybedford’s picture

Thanks so much for this fix. On CCK-6.x-3.0-alpha3, I had to change the file - sites/all/modules/cck/includes/content.node_form.inc for line 365 as in #10.

mattcasey’s picture

This issue still exists in dev. +1 to having the fix committed

mattcasey’s picture

Status: Closed (fixed) » Needs review
689 bytes

This problem comes back when I try to update CCK, so I rerolled the patch for latest version

retiredpro’s picture

thanks mattwad. Your patch fixed my fupload issues. I've been using an older release of CCK 6-3.x-dev for a while now and I'm surprised this issue hasnt been fixed yet.

skylord’s picture

Status: Needs review » Reviewed & tested by the community

Works OK and helps with FUpload problems. Why hasn't it been commited yet?

strawheart’s picture

Attempted to patch 6.3 dev and got a 631 error.

Also, for the "Call to undefined function text_content_is_empty()..." error, I've had it happen on 6.2, 6.3 alpha and 6.3 dev. I gather from reading this thread that it may have to do with Content Profile; so just in case I updated that to the latest dev snapshot as well.

Other than that; I'm not sure what I can do to remove the error. The fact that it impedes users from saving nodes seems to be a pretty big deal. Let me know if you feel I'm missing something.

NathanM’s picture

Would also like to see this fix committed to dev. Very tiring to patch every time there is a new dev version released.

mattcasey’s picture

bump. please let me know if there's anything else we can do to get this patch committed?

KarenS’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

This is not a bug in CCK. As noted already it is a bug in other modules that are not passing the right values to CCK. If we let this bug go through by hiding the error message it just makes it appear that it is working right when it is not.

The bug has to be fixed in the modules that are causing the problems. Patching CCK is not a fix.

mattcasey’s picture

Allright thanks for clarification. I will look into my issue with image fupload

mattcasey’s picture

I think I found a solution to image_fupload, if anyone else is still looking: http://drupal.org/node/623342#comment-6061740. In that case, I noticed that $form was not being passed into node_validate() and #field_info was empty.

RoSk0’s picture

Component: General » content.module
Category: Support request » Bug report
Issue summary: View changes
Status: Closed (won't fix) » Needs review
644 bytes

The real issue is that boolean parameter $teaser, that can be also array of Form API is optional, but this doesn't get checked in content_multiple_value_nodeapi_validate() thus overriding completely valid data in $field param with NULL on includes/content.node_form.inc:351.

happyjoker’s picture

About me, Im get this issue when Im build a new type of filed, and set default option for select list, select list its without key, and the data is big,

so when Im try to save field, its give me an error for undefined function _content_is_empty(), And Im solve this problem by add this

global $count_location_index;

function custom_anees_location_field_is_empty() 
{   $x = $count_location_index++;
    return $x;

this function was set an index for empty index .. and the problem was resolved .

this about my Experience about this error, not for resolve problem, Im set it if its can be hive any help or idea ..

atong_mu’s picture

the patch posted by RoSko fixed the problem with image fupload, no more content_is_empty error from cck. thanks a lot