Closed (fixed)
Project:
Sparkline generator and filter
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
26 Mar 2007 at 05:21 UTC
Updated:
23 Feb 2008 at 22:39 UTC
I get the following error when trying to use sparkline in a post:
Fatal error: Cannot redeclare error_handler() (previously declared in /home/mpcollab/public_html/MPbeta/includes/common.inc:540) in /home/mpcollab/public_html/MPbeta/modules/sparkline/sparkline-php-0.2/lib/Object.php on line 22
Comments
Comment #1
Chris Johnson commentedThis is a known limitation with the library the sparkline module uses, and a known problem with Drupal core polluting the namespace.
You will need to rename the duplicate function in the Sparkline library, for now. Sorry.
Comment #2
Chris Johnson commentedSee core issue http://drupal.org/node/131419.
Comment #3
mcurry commented*subscribe*
Comment #4
Chris Johnson commentedIt appears that Drupal 5 core will not be changed to fix this conflict. So until then, sparkline users will have to hand edit their sparkline library file to rename the error_handler function.
This is fixed in core in Drupal 6.
Comment #5
fm commentedI am only a novice at programming. Would you mind specifying the exact items to be renamed including the file names and line numbers? What should the new names be?
I performed a search and replace on all four lib files, changing "error_handler" to "sparkline_error_handler." Unfortunately, using the sparkline filter now just produces a blank page with no error recorded in the logs.
Comment #6
fm commentedComment #7
Chris Johnson commentedAt approximately line 22 in file lib/Object.php, change "function error_handler" to function sparkline_error_handler".
At approximately line 93 in the same file, change "set_error_handler('error_handler')" to "set_error_handler('sparkline_error_handler')".
Comment #8
fm commentedThanks, that got it working.