#13 Serializing strings with '\r' linebreaks fails, try this...

closed-fixed
None
5
2005-05-26
2005-05-07
FredrikJ
No

When trying to serialize a string with MAC, '\r'
linebreaks, it fails to loadwith the error code

[Server_error] unterminated string literal while
calling ...

I noticed it when debugging qwadframeworks Live Search
example.

I solved with a simple extra line in the file
Serializer.php, in the class "JPSpan_SerializedString"
line 276
function generate(&$code) {
$value =
addcslashes($this->value,"\000\042\047\134");
$value = str_replace("\r\n",'\n',$value);
$value = str_replace("\n",'\n',$value);
$value = str_replace("\r",'\n',$value); //
added for fixing MAC linebreaks in strings
$value = str_replace("\t",'\t',$value);
$code->append("var {$this->tmpName} = '$value';");
}

My client is Mozilla Firefox 1.0.2

Hope this helps...

Discussion

  • Harry Fuecks

    Harry Fuecks - 2005-05-26

    Logged In: YES
    user_id=569780

    Many thanks. Fixed as suggested and CVS. Will go into
    release 0.4.3

     
  • Harry Fuecks

    Harry Fuecks - 2005-05-26
    • assigned_to: nobody --> harryf
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks