PHP Fatal error: Cannot redeclare hex_to_rgb() in /sites/all/modules/imagecache_actions/utility.inc on line 128

Comments

dman’s picture

... and what does the rest of the error message say?

socialnicheguru’s picture

That is all that is printed to my conole. it is not logged in watchdog.

dman’s picture

Odd. I would have expected it to say "hex_to_rgb() already declared in ???"
Where xxx would be useful to know.

It seems that some other module has also been lazy and left off the module name as a prefix - which is the convention.
So at the moment this issue is a conflict with ???
It can be fixed at this end. I'll tidy it up some time.
In the meantime you can either id whatever is conflicting, or as a quick hack, wrap that function (in link 128 utility.inc as it says) inside

if (! function_exists('hex_to_rgb')) {
  function hex_to_rgb(
  ....
  }
}

... although that may not work as expected. Need to know where the other declaration is.

socialnicheguru’s picture

did a grep in my modules directory: dynamic_image also declares function hex_to_rgb

dman’s picture

Cool, that's an answer.
We are both being badly behaved modules.
... at least I only declare that function when I'm actually building the image :-)

I'll rename the func better in dev sometime.

dman’s picture

Version: 6.x-1.2 » 6.x-1.6
Status: Active » Closed (fixed)

Renamed, and using the imageapi hex function where I can