Hi,

I'm getting a large number of notices like this in my watchdog log:

Notice: Undefined variable: voc_desc in taxonomy_vtn_blocks_block() (line 153 of /var/www/drupal/sites/all/modules/taxonomy_vtn/taxonomy_vtn_blocks/taxonomy_vtn_blocks.module).

Since the severity is marked as "error" I'd like to get rid of these notices.

Any ideas?

Thanks!

Comments

AlexisWilke’s picture

asb,

Any idea?

None.

In my version I use the variable $voc_desc on line 228 and it is either set to a DIV tag with data or the empty string. Somehow it feels like something wrong on your install. The last change in that file was Apr 5, 2011 so it would be in 6.x-1.10 which I generated in January.

Thank you.
Alexis

    if ($show_voc_desc) {
      $format = variable_get('taxonomy_vtn_vocabularies_format', TAXONOMY_VTN_DEFAULT_FORMAT);
      if ($format == TAXONOMY_VTN_DEFAULT_FORMAT) {
        $format = FILTER_FORMAT_DEFAULT;
      }
      $voc_desc = '<div class="taxonomy-vtn-description">'. check_markup($voc->description, $format, FALSE) .'</div>';
    }
    else {
      $voc_desc = '';
    }
    if ($show_count_terms) {
      $count_terms = '<div class="taxonomy-vtn-count">'.
                       t('Found !count terms.', array('!count' => $tcount)) .'</div>';
    }
    else {
      $count_terms = '';
    }

    $block['content'] = $voc_desc . theme('item_list', $arr) . $count_terms;
asb’s picture

Thanks for responding so quickly. It's absolutely not impossible that "something" might be wrong with my install, but I have not modified the original code ;)

Also worth mentioning is that I'm getting these errors on different D6 sites, and on different servers (environment: Debian "Squeeze", Pressflow 6.22, PHP 5.3.3-7+squeeze3). On the (older) Debian "Lenny" (with PHP 5.2.6-1+lenny13) I've not noticed these errors . To be more precises, I'm getting these errors on all sites where I have 'Taxonomy VTN' installed.

My "workaround" to suppress the errors that are cluttering my logs is to change the default setting in php.ini from

error_reporting = E_ALL & ~E_DEPRECATED

to

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

This makes the watchdog log much prettier ;) In Debian "Lenny", I was using this error reporting level:

error_reporting = E_ALL & ~E_NOTICE

If there is no way to track down the origin of the error, maybe it's a sane "workaround" to simply suppress the errror messages?

AlexisWilke’s picture

I checked the 1.10 against my version here and they are the same.

I can tell you for sure that on line 153 there is no variable voc_desc.

This means you probably don't have the latest version on those other systems.

One way to find out is to extra 1.10 in a temp folder and then compare with diff (or cmp) to see whether you get differences. If yes, then you know what the problem is... If not, check on line 153 and let me know whether you can see the offensive variable there. If not... then it's probably PHP going funky.

Do you remove comments by any chance? It could be that you run a parser to remove "useless" entries such as empty lines and comments... ?

Thank you.
Alexis Wilke

P.S. Obfuscation works just fine otherwise, not just in software. 8-)

asb’s picture

Line 153 of /var/www/drupal/sites/all/modules/taxonomy_vtn/taxonomy_vtn_blocks/taxonomy_vtn_blocks.module reads on my servers:

// $Id: taxonomy_vtn_blocks.module,v 1.1.2.9 2010/04/05 00:16:00 alexiswilke Exp $
...
$arr[$voc->name][] = l($voc->name . $count_terms . $count_nodes . $voc_desc, $href, array('html' => TRUE ));

That's exactly the code I'm getting when downloading http://ftp.drupal.org/files/projects/taxonomy_vtn-6.x-1.10.zip and go to line 153 in taxonomy_vtn/taxonomy_vtn_blocks/taxonomy_vtn_blocks.module. There is no diff between the files from http://ftp.drupal.org/files/projects/taxonomy_vtn-6.x-1.10.zip and those on my sites ;)

In this file, there is $voc_desc in line 153, and the error message says nothing but "I don't know what string I'm supposed to concatenate after $count_nodes", right? However, if I'm guessing right, the eror message might be correct since I'm not using much "vocabulary descriptions", so this string will be empty in most cases if it's status isn't evaluated somewhere with something like "don't try to print me if I'm empty" (I'm no programmer, so I can't provide much help with the code, sorry).

Greetings, asb

AlexisWilke’s picture

Status: Active » Fixed

Nevermind! I looked at the wrong file... So here I stand corrected!

See the patch below for the fix.

Thank you for your patience and help!
Alexis Wilke

See: http://drupalcode.org/project/taxonomy_vtn.git/commit/d21d077

asb’s picture

Thanks! Looking forward to 6.x-1.11 ;)

Status: Fixed » Closed (fixed)

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