Options

BUG: http://upload.smugmug.com/ PHP response type returns formatted string

lildudelildude Registered Users Posts: 70 Big grins
The PHP response type for http://upload.smugmug.com/ returns a 'formatted' string. It's formatted in as much as the string includes newline and space characters which prevent unserialize() from unserializing the entire string.

The output returned is as follows (I've used addcslashes($string, " \n") to show where the extra formatting chars are):
a:3:{\n\ \ s:4:"stat";\n\ \ s:2:"ok";\n\ \ s:6:"method";\n\ \ s:21:"smugmug.images.upload";\n\ \ s:5:"Image";\n\ \ a:3:{\n\ \ \ \ s:2:"id";\n\ \ \ \ i:306617214;\n\ \ \ \ s:3:"Key";\n\ \ \ \ s:5:"byqMb";\n\ \ \ \ s:3:"URL";\n\ \ \ \ s:69:"http://colinseymour.smugmug.com/gallery/5088374_Zufg5#306617214_byqMb";\n\ \ }\n}\n

Without using addcslashes() we get:
a:3:{
  s:4:"stat";
  s:2:"ok";
  s:6:"method";
  s:21:"smugmug.images.upload";
  s:5:"Image";
  a:3:{
    s:2:"id";
    i:306611555;
    s:3:"Key";
    s:5:"5rVaN";
    s:3:"URL";
    s:69:"http://colinseymour.smugmug.com/gallery/5088297_KJWhM#306611555_5rVaN";
  }
}

This was done with 2 different queries, but it illustrates the point.

Whilst this looks very pretty, it's not very functional :wink Stripping out the spaces and newlines results in a string that unserialize can work with.
Sign In or Register to comment.