Hi. I recently updated to 4.4.2 from 4.2. I started clean and added new modules as needed. The notify module 4.4.0 causes this error in cron.php:

Fatal error: Call to undefined function: html_entity_decode() in /var/www/smithson/modules/notify/notify.module on line 24

Anybody know how to fix this?

Comments

Anonymous’s picture

I see no function called html_entity_decode within notify.module and I don't know where it expects to get the module from. Boo, I hate to actually have to work to figure things out. ;)

Anonymous’s picture

So, here I am again, the anonymous seeker, speaking to nobody in particular. I found that html_entity_decode is a PHP builtin function (http://us4.php.net/manual/en/function.html-entity-decode.php) that requires (PHP 4 >= 4.3.0, PHP 5). I am currently using PHP Version 4.2.3. Oops. Time to rebuild.

Anonymous’s picture

Thanks to dave at codexweb dot co dot za for providing this code for less than 4.3 versions of PHP. It is an easier fix than upgrading, in my case anyway. Only problem is that links to nodes are just plain text in the emails.


if (!function_exists('html_entity_decode')) {

  function html_entity_decode ($string, $opt = ENT_COMPAT) {

   $trans_tbl = get_html_translation_table (HTML_ENTITIES);
   $trans_tbl = array_flip ($trans_tbl);

   if ($opt & 1) { // Translating single quotes

     // Add single quote to translation table;
     // doesn't appear to be there by default
     $trans_tbl["'"] = "'";
   }

   if (!($opt & 2)) { // Not translating double quotes

     // Remove double quote from translation table
     unset($trans_tbl["""]);
   }

   return strtr ($string, $trans_tbl);
  }
}

// Just to be safe ;o)
if (!defined("ENT_COMPAT")) define("ENT_COMPAT", 2);
if (!defined("ENT_NOQUOTES")) define("ENT_NOQUOTES", 0);
if (!defined("ENT_QUOTES")) define("ENT_QUOTES", 3);

Anonymous’s picture

Hmm...for some reason color coding of PHP code is not working here at drupal.org at the time of this writing. Anyhow, I had to make a final adjustment to notify.module to make links in notification work. I'm not sure why I had to do this, but I'm guessing it is again due to my version of PHP being less than 4.3.

At line 89 and 95, change from:

$body .= " [ ". url("queue/view/$node->nid") ." ]\n\n";

to:

$body .= " [ ". "$base_url/" . url("queue/view/$node->nid") ." ]\n\n";

I hope this helps somebody.

dsmithson’s picture

I finally added a Drupal account. All of the above messages are from me. What the hell happened to code display?

RobRoy’s picture

Version: 4.4.x-1.x-dev » master
Status: Active » Closed (fixed)

Closing old bugs.