When "memcache admin" is enabled, and the "show memcache statistics at the bottom of each page" option is selected on admin/settings/memcache, file uploads fail.

The fix is easy, just replace the following line in memcache_admin_init():

if (($user->uid == 0) || strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete')) {
  

with this (heavily borrowing from devel module)

if (($user->uid == 0) || strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete') || $_GET['q'] == 'admin/content/node-settings/rebuild' || $_GET['q'] == 'upload/js' || substr($_GET['q'], 0, strlen('system/files')) == 'system/files') {

-mike

CommentFileSizeAuthor
#2 memcache_admin.module.319697.patch907 bytesjaydub
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeremy’s picture

Status: Active » Needs review

Can someone test this and confirm it solves the problem? (Attaching a real patch would certainly help...)

jaydub’s picture

ambo’s picture

Hi,

i run into this issue on a drupal installation using imagecache. for some reason imagecache is redirecting to itsself if a picture is rebuild with imagemagick or gd-lib. in this case drupal has not run the full bootstrap so no theming is available. memcache admin still wants so theme the memcache stats, and therefor has to implement theming functions. but in php's shutdown function working directory is set to / so no relative requires or includes are possible.

in memcache.admin on line 223 you still check for soe content-types which don't like text outputs, maybe it is usefull to check some more (dunno what header exists while processing images) here?

quicksketch’s picture

Status: Needs review » Needs work

Memcache is responsible for many instances of file uploads breaking in the FileField queue, see #297035: HTTP error 0 . Rather than checking certain paths however, a more reliable method would be checking headers for any type other than "text/html", as Devel module currently does.

Exploratus’s picture

Version: 5.x-1.8 » 6.x-1.6

I just installed memache, and when i try to upload a file i get AHAH problem and it breaks - Version 6.x - 1.6. Any solutions?

Jeremy’s picture

Status: Needs work » Postponed (maintainer needs more info)

Are you able to duplicate with the latest -dev snapshot?

Fabianx’s picture

Version: 6.x-1.6 » 6.x-1.8
Assigned: Unassigned » Fabianx

Problem is still active in 6.x-1.8.

I'll fix this soon as it would be nice to have memcache admin not break all upload fields ...

catch’s picture

Assigned: Fabianx » Unassigned
Status: Postponed (maintainer needs more info) » Needs work

Re-opening this. #372810: Lots of failed include_once errors is duplicate.

catch’s picture

Component: Code » memcache_admin
Priority: Normal » Major
Jeremy’s picture

Status: Needs work » Fixed

Duplicated, and patch applied (with some minor changes). Confirmed that file uploads were broken before the patch, and work after the patch (using the core upload module).
http://drupalcode.org/project/memcache.git/commitdiff/566d3e9

Jeremy’s picture

Version: 6.x-1.8 » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)

Whoops, needs to be ported to 7.x-dev.

catch’s picture

Status: Patch (to be ported) » Fixed

Applied fine via cherry pick. Pushed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.