gtquang / serialized-php-parser

Automatically exported from code.google.com/p/serialized-php-parser
0 stars 0 forks source link

Newline character isn't handled properly #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This could be a problem with my application because the serialized string gets 
passed through a few steps before it gets to the parser itself, but I've got a 
string that has a newline characters in it. The character is (apparently) 2 
bytes long, but it's being treated as 1, so the parser fails to suck up the 
final X number of characters, which of course throws off the rest of the 
parser. My solution is to replace any newlines with a unused character before 
passing it to my application, then changing it back to a newline once it gets 
to the application, but this is not exactly the ideal solution. 

As far as I can tell, to reproduce the behavior, simply serialize a newline 
character. I'm not much help beyond that, because I'm not that familiar with 
character handling at such a low level.

Original issue reported on code.google.com by Campu...@gmail.com on 8 Nov 2010 at 8:34

GoogleCodeExporter commented 8 years ago
Hello.
As far as I know, PHP returns the serialized data into a single string. 
serialized-php-parser assumes that the data from PHP to the 
serialized-php-parser come to him directly to the input without any external 
processing. Your solution with the removal of special characters like \r, \n, 
\r\n of the input string is correct in logic. Modification of 
serialized-php-parser is not required.
Thank you for the information.

Original comment by forpdfse...@gmail.com on 1 Jul 2011 at 9:01