Okay here's the deal. I played around with this for the last couple of days to see if it was my configuration, or if there was a workaround to no avail.

I receive a timeout when trying to add or modify actions in imagecache. I can add a new scale, resize, or crop action just fine. But when I try to add values to any of these and click on the "Update Preset" button it times out. That said, I can sometimes get a value in scale, but any modification to it or when I create an additional scale action it times out just as before. The error it throws when timing out is below.

Location http://www.glosswerks.com/drupal/?q=admin/imagecache/preset/5
Referrer http://www.glosswerks.com/drupal/?q=admin/imagecache/preset/5
Message array_walk() [function.array-walk]: Unable to call () - function does not exist in /home/alfa/public_html/drupal/includes/common.inc on line 512.
Severity error

What do you guys think? I don't have a bug do I? If not, any further troubleshooting I should do?

CommentFileSizeAuthor
#5 Imagecache Administration drupal.png63.39 KBJJMcKay

Comments

dopry’s picture

What version of drupal and imagecache are you using?

JJMcKay’s picture

Drupal 4.7.4 and imagecache.module,v 1.9.2.11 2006/11/15

dopry’s picture

Can put drupal_set_message(''. print_r(debug_backtrace(), TRUE) .'');
in common.inc on line 511, and paste me the output.

It seems like a magic_quotes_gpc error somewhere. Disabling magic_quotes should be a symptomatic solution.

dopry’s picture

silly escaping, those were supposed to be pre tags.

JJMcKay’s picture

StatusFileSize
new63.39 KB

Well that changed something. Bad news first, right? It still times out when trying to define a parameter for the preset. The good news, I think is that it doesn't throw an error that is logged. Actually that might be bad as it makes it harder to trouble shoot. It also, as you said it would spit out a bunch of debugging information where the error was usually displayed. Keep in mind, however, that I can't paste anything from when it is trying to update the action and times out because... it times out. I can paste the debug output on the screen before I update it however.

    * Array ( [0] => Array ( [function] => _fix_gpc_magic [args] => Array ( [0] => admin/imagecache [1] => q ) ) [1] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 531 [function] => array_walk [args] => Array ( [0] => Array ( [q] => admin/imagecache ) [1] => _fix_gpc_magic ) ) [2] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 1429 [function] => fix_gpc_magic [args] => Array ( ) ) [3] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 788 [function] => _drupal_bootstrap_full [args] => Array ( ) ) [4] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 737 [function] => _drupal_bootstrap [args] => Array ( [0] => 4 ) ) [5] => Array ( [file] => /home/alfa/public_html/drupal/index.php [line] => 13 [function] => drupal_bootstrap [args] => Array ( [0] => 4 ) ) )
    * Array ( [0] => Array ( [function] => _fix_gpc_magic [args] => Array ( [0] => 93676576db1c36780c625c341dd6dd12 [1] => PHPSESSID ) ) [1] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 533 [function] => array_walk [args] => Array ( [0] => Array ( [PHPSESSID] => 93676576db1c36780c625c341dd6dd12 ) [1] => _fix_gpc_magic ) ) [2] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 1429 [function] => fix_gpc_magic [args] => Array ( ) ) [3] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 788 [function] => _drupal_bootstrap_full [args] => Array ( ) ) [4] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 737 [function] => _drupal_bootstrap [args] => Array ( [0] => 4 ) ) [5] => Array ( [file] => /home/alfa/public_html/drupal/index.php [line] => 13 [function] => drupal_bootstrap [args] => Array ( [0] => 4 ) ) )
    * Array ( [0] => Array ( [function] => _fix_gpc_magic [args] => Array ( [0] => admin/imagecache [1] => q ) ) [1] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 534 [function] => array_walk [args] => Array ( [0] => Array ( [q] => admin/imagecache [PHPSESSID] => 93676576db1c36780c625c341dd6dd12 ) [1] => _fix_gpc_magic ) ) [2] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 1429 [function] => fix_gpc_magic [args] => Array ( ) ) [3] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 788 [function] => _drupal_bootstrap_full [args] => Array ( ) ) [4] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 737 [function] => _drupal_bootstrap [args] => Array ( [0] => 4 ) ) [5] => Array ( [file] => /home/alfa/public_html/drupal/index.php [line] => 13 [function] => drupal_bootstrap [args] => Array ( [0] => 4 ) ) )
    * Array ( [0] => Array ( [function] => _fix_gpc_magic [args] => Array ( [0] => 93676576db1c36780c625c341dd6dd12 [1] => PHPSESSID ) ) [1] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 534 [function] => array_walk [args] => Array ( [0] => Array ( [q] => admin/imagecache [PHPSESSID] => 93676576db1c36780c625c341dd6dd12 ) [1] => _fix_gpc_magic ) ) [2] => Array ( [file] => /home/alfa/public_html/drupal/includes/common.inc [line] => 1429 [function] => fix_gpc_magic [args] => Array ( ) ) [3] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 788 [function] => _drupal_bootstrap_full [args] => Array ( ) ) [4] => Array ( [file] => /home/alfa/public_html/drupal/includes/bootstrap.inc [line] => 737 [function] => _drupal_bootstrap [args] => Array ( [0] => 4 ) ) [5] => Array ( [file] => /home/alfa/public_html/drupal/index.php [line] => 13 [function] => drupal_bootstrap [args] => Array ( [0] => 4 ) ) )

And just to make sure, I placed your code so that lines 510-522 look as such:

function _fix_gpc_magic(&$item) {
	drupal_set_message('
	
	'. print_r(debug_backtrace(), TRUE) .'
	
	');
  if (is_array($item)) {
    array_walk($item, '_fix_gpc_magic');
  }
  else {
    $item = stripslashes($item);
  }
}
JJMcKay’s picture

You don't think another module is conflicting do you? CCK or otherwise..

dopry’s picture

Array Walk seems to be getting valid input. I don't know why that error would be popping up in fix_magic_gpc().

As for the timeout issues... Is there anything in your webservers error logs? what web server are you running?
Is it requesting the proper domain name? Is there anything in watchdog? Can you add some debugging steps the print output throughout the work flow? Does upgrading to 4.7.x-dev solve your issues?

chrisschaub’s picture

Component: User interface » Code
Category: support » bug

I'm having the same issue, 4.7.4 on Linux, even bumped the memory to 256M . I've also updated the common.inc to the latest 4.7.4 rev since the gpc stuff was slightly patched.

Watchdog is recording this error ...

array_walk() [function.array-walk]: Unable to call 1.15894751662E-268() - function does not exist in /home/.....

Dying on line 512 in common.inc

It's trying to call a really bogus function name for the walk. Or maybe this is some weird watchdog translation error and not a problem.

It's funny, I can create a preset and then delete it. But after I add an action (say resize) then I can't do anything, just hangs. Delete, flush and update hang. I think the flush is hanging because its called by all three, but I'm not sure. Oh, and I can't create more than one preset after I add an action to the first one. I've also tried adding a "magic_quotes_gpc -> 0" to my php.ini with no luck.

Disabling the array_walk at line 512 in common.inc fixes the problem. Strange.

I've disabled all non-core mods except for image, nice menus and imagecache. So, I think there's a bug in imagecache or common or both?

Any help is greatly appreciated.

chrisschaub’s picture

Ok, maybe this will help somebody else. If your php is running via CGI (not an apache module) using suexec then you might need to create a php.ini file in the root of your drupal install to turn off magic quotes. Then add the line ...

magic_quotes_gpc=off

to the php.ini file. All set, imagecache now works, no more hanging for me. I didn't think to check the php exec method. This also means that the major php overrides in the .htaccess supplied with drupal 4.7.x will not affect this type of install. You'll need to check the execution method of php and adjust. Can't say this will work everywhere, but it worked for me.

jurriaanroelofs’s picture

I had the same problem, time outs when specifying actions. However, I installed the module on another site, on the same server, and it worked without problems.

Dopry, you asked the other person: "Is it requesting the proper domain name?"
What do you mean by that and how do you check it? Because I installed drupal on this account before the domain was connected, and now it's on a temporary domain so that I could work with clean urls, is that bad?

dopry’s picture

You just have to have magic_quotes_gpc off. To check the domain, look at the URL. Is this still an issue with imagecache or is it resolved? I can't reproduce.

rickvug’s picture

Is there any chance that the module could be patched to work with magic_quotes_gpc turned on? This is the default setting for many popular web hosts (Site5 + MediaTemple are confirmed to default to "on"). Dealing with PHP configuration is beyond most Drupal users.

seanenroute’s picture

I found that I was able to eliminate the error by upgrading my server to PHP5 from PHP4. With my hosting company it was just a matter of adding a line to my .htaccess file (http://faq.1and1.com/scripting_languages_supported/php/9.html).

# Converts files to PHP5
AddType x-mapp-php5 .php

Hope this helps.

dopry’s picture

Status: Active » Closed (won't fix)

The problem for the case reported here originally occurs in _fix_gpc_quotes which is not a part of imagecache. And should provide compatibility with gpc_magic_quotes on or off already. This may be a php4/php5 compatibility issue with Drupal in general. So I'm setting it to won't fix regarding the gpc_magic_quotes issue.

jurriaanroelofs’s picture

I'm having the same problem.
Like with other people in this discussion, this site was transferred from a temporary domain to a final domain before I found out it was broken.

I have verified that on this same server, on the same cpanel account, I can run imagecache without problem. I did this by just installing another drupal in a subfolder of this site, while it was on the final domain.

if someone could shed some light on this it would be greatly appreciated.

jurriaanroelofs’s picture

if someone reads this and still doesn't understand what to do, as far as I know the easiest fix (hack) is to go to includes/common.inc and disable array_walk at line 512, by preceding the line with 2 slashes, like so:

// array_walk($item, '_fix_gpc_magic');

dopry’s picture

Can you please provide the php versions you are using?