Various module "notices" with Drupal 6.x-dev

Ryan Palmer - July 1, 2008 - 20:19
Project:Content Templates (Contemplate)
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I have been using contemplate on a Drupal 6.2 site for a few weeks, but had to upgrade to Drupal-6.x-dev due to an issue with views (a templating issue, actually.. #275371: Problem theming a view) that required a bug fix in core.

After upgrading, I get the following errors:

    * notice: Undefined variable: file in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 598.
    * notice: Undefined variable: file in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 598.
    * notice: Undefined index: flags in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 486.
    * notice: Undefined variable: file in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 598.
    * notice: Undefined index: flags in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 486.
    * notice: Undefined index: flags in /home/brainquest/bq-drupal/sites/all/modules/contemplate/contemplate.module on line 178.

Line 178:

<?php
   
case 'alter':
      if (
$template = contemplate_get_template($node->type)) {
        if (
$teaser) {
          if (
CONTEMPLATE_TEASER_ENABLED & $template['flags'] && trim($template['teaser'])) { // only if there's content in teaser field
           
$node->teaser = contemplate_eval($template['teaser'], $node, $xml_elements);
          }
        }
        elseif (
CONTEMPLATE_BODY_ENABLED & $template['flags'] && trim($template['body'])) { // only if there's content in the body field // LINE 178
         
$node->body = contemplate_eval($template['body'], $node, $xml_elements);
        }
      }
      break;
?>

Line 486:

<?php
   
foreach ($fields as $field => $enable) {
      if (
$file = contemplate_get_file($type, $field)) {
       
$types[$type][$field] = $file->contents;
       
$types[$type][$field .'-file'] = $file;
       
$types[$type]['flags'] |= $enable; // if there is a file, the field is always enabled...
     
}
     
$types[$type][$field .'-enabled'] = $types[$type]['flags'] & $enable ? TRUE : FALSE; // LINE 486
   
}
?>

Line 598:

<?php
function contemplate_get_file($node_type, $field) {
 
$files = contemplate_available_files();
  if (isset(
$files['node-'. $node_type .'-'. $field .'.tpl'])) {
   
$file = $files['node-'. $node_type .'-'. $field .'.tpl'];
  }
  elseif (isset(
$files['node-'. $node_type .'.tpl'])) {
   
$file = $files['node-'. $node_type .'.tpl'];
  }
  elseif (isset(
$files['node.tpl'])) {
   
$file = $files['node.tpl'];
  }

  if (
$file) { // LINE 598
   
$file->contents = file_get_contents($file->filename);
   
$return = $file;
  }
  else {
   
$return = FALSE;
  }
  return
$return;
}
?>

#1

Ryan Palmer - July 1, 2008 - 20:20

If it makes any difference:

MySQL database 4.1.10
PHP 5.2.6
PHP memory limit 128M
PHP register globals Disabled
Unicode library Standard PHP - Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.
Web server Apache/2.0.46 (Red Hat)

#2

Aren Cambre - July 6, 2008 - 02:52
Project:Content Templates (Contemplate)» Drupal
Version:6.x-0.13» 6.x-dev
Component:Code» base system
Priority:normal» critical

This is almost certainly a Drupal core problem. I'm getting similar errors with the core Search and the contributed TinyMce 2 (6.x-1.1-dev (2008-Mar-31)) modules.

I am running Drupal 6.x-dev (2008-Jul-05).

#3

Aren Cambre - July 6, 2008 - 02:52

BTW, here are specific errors:

    * notice: Undefined index: body_field in /homepages/18/d93080087/htdocs/drupal6/sites/scratch.cambre.biz/modules/tinymce 2/tinymce.module on line 90.
    * notice: Undefined index: #type in /homepages/18/d93080087/htdocs/drupal6/modules/search/search.module on line 1097.

#4

Aren Cambre - July 6, 2008 - 02:53
Title:Undefined variable, Undefined index errors when using Contemplate 6.x-0.13 with Drupal 6.x-dev» Various Undefined variable, Undefined index, etc. module errors with Drupal 6.x-dev

Adjusting title.

#5

webchick - July 6, 2008 - 22:34
Project:Drupal» Content Templates (Contemplate)
Version:6.x-dev» 6.x-1.x-dev
Component:base system» Code
Priority:critical» normal

Please don't mix bug reports. The search index already has an open ticket (always search first, before opening new issues). The errors you listed in the initial report are clearly the fault of contemplate.module and nothing to do with Drupal core, so moving this issue back over to that queue.

Additionally, notices are not "critical" bugs. Notices are relatively harmless and are thus normally suppressed; the development versions of Drupal display them to help developers to not write code with notices in it.

#6

Aren Cambre - July 7, 2008 - 00:42

Thanks. Didn't realize that distinction about "notices."

#7

Aren Cambre - July 7, 2008 - 00:43
Title:Various Undefined variable, Undefined index, etc. module errors with Drupal 6.x-dev» Various module "notices" with Drupal 6.x-dev

Changing title.

BTW, webchick, I would search if a search engine was available!

#8

webchick - July 7, 2008 - 01:59

Issue search is always available. :D http://drupal.org/project/issues/search/

#9

Aren Cambre - July 7, 2008 - 02:33

THANK YOU!!!

#10

Ryan Palmer - July 14, 2008 - 20:04
Status:active» fixed

Seems to be fixed when used in conjunction with Drupal 6.3. I'm not sure what specifically was fixed.

#11

jrglasgow - July 14, 2008 - 20:37

as webchick said in comment #5 in the dev releases the notices are enabled, in the stable release the notices are suppressed.

#12

webchick - July 14, 2008 - 21:18
Status:fixed» active

Yep. I assume this is still a problem in dev releases.

 
 

Drupal is a registered trademark of Dries Buytaert.