Problem identified
straight_up - July 21, 2006 - 18:32
| Project: | Coolfilter |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | lllkkk |
| Status: | closed |
Jump to:
Description
I used the package from the author's site, which includes the required PEAR packages.
This code:
[coolcode lang="php"]
...
[/coolcode]Generates the following error:
Fatal error: Call to undefined method PEAR_Error::highlight() in /homepages/12/d95635462/htdocs/ajh/drupal/modules/coolfilter/coolcode.php on line 226
Omitting a lang="" attribute WORKS FINE but obviously does not highlight the code as PHP syntax.

#1
It appears that this line:
<?php$hl =& Text_Highlighter::factory($lang, $options);
?>
causes $hl to be set to
PEAR_Error. In other words, somethings is wrong with either the settings passed to factory(), or within Text/Highligher.php.#2
This can happen when you change any of the following lines in coolcode.php:
<?php
$pear_dir = "/homepages/12/d56857136/htdocs/ajh/drupal/modules/coolfilter/pear";
if(is_dir($pear_dir))
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $pear_dir);
require_once('Text/Highlighter.php');
?>
This is because Text/Hightlight.php also needs to include files, so include_path needs set.
This can cause problems:
<?php
$pear_dir = "/homepages/12/d56857136/htdocs/ajh/drupal/modules/coolfilter/pear";
if(is_dir($pear_dir))
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $pear_dir);
require_once('/Text/Highlighter.php');
?>
So can this:
<?php
$pear_dir = "/homepages/12/d56857136/htdocs/ajh/drupal/modules/coolfilter/pear";
require_once($pear_dir.'/Text/Highlighter.php');
?>
#3
I have tesed it on two different servers (one clean Install drupal & coolfilter), all of them have No Problem.
Please read doc on http://www.kylinx.net/node/118 carefully, it module needs an INSTALLATION, before you use it.
#4
code like this is right.
$pear_dir = "/var/www/localhost/htdocs/drupal/modules/coolfilter/pear";if(is_dir($pear_dir))
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $pear_dir);
require_once 'Text/Highlighter.php';
#5