Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Since updating to 2.5 (for SA-CONTRIB-2009-051) with the 5.x branch of imagecache one of our sites has been throwing PHP errors for any new images uploaded when trying to display them via imagecache:
call_user_func(imagecache_resize_image): First argument is expected to be a valid callback...
I guess this stems from this change ie moving these functions from imagecache.module to imagecache_actions.inc and this file not seemingly being included. Reverting that change fixes things. Could anyone shed any light onto where imagecache_actions.inc actually gets included and why in this case it isn't?
Comment | File | Size | Author |
---|---|---|---|
#14 | imagecache_5.25_fix.patch | 461 bytes | sergtop |
#4 | call_actions_2.patch | 1.09 KB | Ozeuss |
#2 | call_to_actions.patch | 792 bytes | Ozeuss |
Comments
Comment #1
pfaocleGah, I meant this diff.
Comment #2
Ozeuss CreditAttribution: Ozeuss commentedThe reason is like mentioned above. Although the correct file is recorded in the $action array, there is no specific call to the file itself- so imagecache doesn't display *any* images.
I've marked as critical, since this breaks sites (in a stable version).
A patch is attached.
Comment #3
Ozeuss CreditAttribution: Ozeuss commentedComment #4
Ozeuss CreditAttribution: Ozeuss commentedI noticed that there is a missing reference to the action file just for resize on 'imagecache_imagecache_actions',
rerolling.
Comment #5
chrisschaub CreditAttribution: chrisschaub commentedThis patch fixes the problem. This is a very big bug, can this please get rolled as a point release? Currently, this is breaking all 5.x sites.
Thank you.
Comment #6
protoplasm CreditAttribution: protoplasm commentedI have had similar problems with upgrading from 5.x-2.4 to 5.x-2.5. Applying this patch to 5.x-2.5 causes me this error, but at least now allows function:
* warning: include_once() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/lib/php') in public_html/sites/all/modules/imagecache/imagecache.module on line 383.
* warning: include_once() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/lib/php') in public_html/sites/all/modules/imagecache/imagecache.module on line 383.
Thanx.
Comment #7
nodecode CreditAttribution: nodecode commentedSimilar situation here:
* warning: call_user_func(imagecache_resize_image) [function.call-user-func]: First argument is expected to be a valid callback in /var/www/html/sites/all/modules/imagecache/imagecache.module on line 381.
* warning: call_user_func(imagecache_resize_form) [function.call-user-func]: First argument is expected to be a valid callback in /var/www/html/sites/all/modules/imagecache/imagecache_ui.module on line 435.
Comment #8
protoplasm CreditAttribution: protoplasm commentedI'm am still using 5.x-2.4 because of the above problem. Any ideas about a solution? dev file has similar problems.
Comment #9
rainbreaw CreditAttribution: rainbreaw commentedI found that it is critical that you upgrade ImageField before upgrading ImageCache. That, combined with the help above, seems to have solved my difficulties with the ImageCache upgrade.
Comment #10
protoplasm CreditAttribution: protoplasm commentedSince the proper functioning of imagecache is so crucial to my website, I decided to forge ahead with an upgrade from 5.20 to 6.14 with imagecache 5.x-2.5 in place (the version causing my difficulties) and my problems with imagecache went away.
Comment #11
cdoyle CreditAttribution: cdoyle commentedI was having the same problem as #6 and #7 so I did a dirty patch to get around it. I replaced line 383 (after patching) with the following:
I haven't had time to track down where the call with an empty $action['file'] is coming from.
Comment #12
kingandy CreditAttribution: kingandy commentedSame problem can crop up in imagecache_ui - line 435.
Adding more-or-less the same code before the call_user_func() works again:
(Shouldn't the if (!function_exists()) check in imagecache.module check for the actual function to be called as well? It checks for $action['action'] then proceeds to call $action['action'].'_image'. I know in this instance the existence of one will imply the existence of the other but ... it feels sloppy.)
Regarding the "Failed opening '' for inclusion" errors - I suspect these were due to the imagecache_action_definitions() function cacheing the results of the hook_imagecache_actions - which meant the resize action was cached without the 'file' entry on it. Clearing the cache solved the issue on my site. TBH I have the suspicion that the lack of a 'file' on the resize action is what caused the imagecache_actions.inc file to not be included in the first place, but I don't have time to investigate right now... sorry.
Comment #13
sergtop CreditAttribution: sergtop commentedThe problem from http://drupal.org/node/554932#comment-2159276 is perfectly solved with the patch from http://drupal.org/node/554932#comment-2013396.
But you shoud manually clear imagecache_actions row from cache table.
Comment #14
sergtop CreditAttribution: sergtop commentedthis one is enough to solve the problem
but if you are upgrading a module you should clear the `cache` table.
Comment #15
allella CreditAttribution: allella commented#14 + clearing cache tables fixed my issue too. Thanks
Comment #16
pfaocle"#14 + manually emptying cache table fixed my issue too." - ditto, using version 5.x-2.5.
Comment #17
drewish CreditAttribution: drewish commentedThanks, committed to DRUPAL-5--2.