I have a site running on IIS 6.0/Windows Server 2003 configured with private files (Drupal file handling). Private files directory contains \ (Windows directory separator).
I use SWFUpload with FileField. SWFUpload works OK when creating nodes.
If I edit a node containing a file without changing the file, I get an error when saving content : Fatal error: Cannot unset string offsets in path_to_file\swfupload_widget.inc on line 63

The error come from json_decode failure to decode the string passed by the form because it contains backslash (\) in the filepath value (e.g. "filepath":"D:\inetpub\wwwroot\mysite\files/sample.txt").

I have written a workaround. I don't know if this is the right thing to do but it works.

function swfupload_widget_value($element, $edit = FALSE) {
  if (is_string($edit)) {
    // original code - return null if string contains unescaped \
    //$edit = json_decode($edit, TRUE);
    // modified code
    $edit = json_decode(str_replace("\\", "\\u005c", $edit), TRUE);
  }

Comments

kundu’s picture

I use SWFUpload with FileField. SWFUpload works OK when creating nodes.
If I edit a node containing a file without changing the file, I get an error when saving content : Fatal error: Cannot unset string offsets in path_to_file\swfupload_widget.inc on line 63

I have the same problem, but my server is Linux...

divined’s picture

Version: 6.x-2.0-beta8 » 7.x-1.x-dev
Issue summary: View changes

the same