致命错误:创建模块后,在drupal 6中调用未定义的函数错误

时间:2012-11-11 14:18:45

标签: mysql drupal-6

enter image description here我正在研究Drupal 6网站,尽管我是Drupal和php的新手。我正在基于现有模块的代码创建一个模块,我得到一个“致命错误:调用未定义的函数... return_zip_codes()in .... / modules / cck / content.module(1694):eval ()'第2行代码'错误。发生此错误时,我通过Web界面丢失了对drupal站点的所有访问权限。我已经删除了有问题的模块并尝试清除所有cac enter image description here hes并使用Drush运行cron并使用mysql命令行清除缓存表但错误仍然存​​在。由于错误,运行drush cron和drush cc all也“中止”。当我谷歌错误时,我没有得到太多。我附上了原始错误的屏幕截图。

我在堆栈跟踪上注释掉了一行,我设法让网站重新启动,但是当我点击一个链接注册一个新成员时,我收到了另一个错误。同时注释掉该行会导致某些表单与目标网页的某些元素一起显示不正确。

我附上了我得到的错误的打印屏幕以及我编辑的一些代码。如果您需要我提供更多信息和代码,请告诉我。

谢谢

我在第1694行的content.module文件中注释掉的第一行的代码

enter code here

  $allowed_values[$cid] = array();
if (isset($field['allowed_values_php'])) {
ob_start();
//    $result = eval($field['allowed_values_php']);
if (is_array($result)) {
  if ($flatten) {
    $result = content_array_flatten($result);
  }
  $allowed_values[$cid] = $result;
}
ob_end_clean();
}

我创建的模块中的代码导致了错误:

enter code here

    'widget_active' => '1',
'type' => 'text',
'required' => '1',
'multiple' => '0',
'module' => 'text',
'active' => '1',
'text_processing' => 0,
'max_length' => '',
'allowed_values' => '',
'allowed_values_php' => 'module_load_include(\'inc\', \'online_![enter image      description here][3]mem_apps\', \'/includes/online_mem_apps.zip_codes\');
return online_mem_apps_return_zip_codes(TRUE);',
'field_permissions' => array(
  'create' => 0,
  'edit' => 0,
  'edit own' => 0,
  'view' => 0,
  'view own' => 0,
),

1 个答案:

答案 0 :(得分:0)

经过近一天的努力,我找到了一个隐藏在Google中的解决方案。显然在其中一个内容字段中有一些php代码,其中包含我创建的模块的代码。更改此代码修复了我的问题。我已经在下面的网站中添加了一个链接。我希望它可以帮助有类似问题的人。

http://www.econcepts.co.uk/snippets/receiving-a-500-internal-server-error-in-drupal#comment-79