Buggy code:
public class SerializedPhpParserTest extends TestCase { public void testParseNull ( ) throws Exception { } public void testParseInteger ( ) throws Exception { } public void testParseFloat ( ) throws Exception { } public void testParseBoolean ( ) throws Exception { } public void testParseString ( ) throws Exception { } @ SuppressWarnings ( "rawtypes" ) public void testParseArray ( ) throws Exception { } public void testParseObject ( ) throws Exception { } @ SuppressWarnings ( "rawtypes" ) public void testParseComplexDataStructure ( ) throws Exception { <START_BUG> String input = "a:2:{i:0;a:8:{s:5:\"class\";O:7:\"MyClass\":1:{s:5:\"pippo\";s:4:\"test\";}i:0;i:1;i:1;d:0.19999998807907104;i:2;b:1;i:3;b:0;i:4;N;i:5;a:1:{i:0;s:42:\"\";\";\";\";\";��T�R��T����L\";\";\";\";\";\";}i:6;O:6:\"Object\":0:{}}i:1;a:8:{s:5:\"class\";O:7:\"MyClass\":1:{s:5:\"pippo\";s:4:\"test\";}i:0;i:1;i:1;d:0.19999998807907104;i:2;b:1;i:3;b:0;i:4;N;i:5;a:1:{i:0;s:42:\"\";\";\";\";\";��T�R��T����L\";\";\";\";\";\";}i:6;O:6:\"Object\":0:{}}}" ; <END_BUG> new SerializedPhpParser ( input ) . parse ( ) ; input = "a:1:{s:9:\"ResultSet\";a:4:{s:21:\"totalResultsAvailable\";s:7:\"1177824\";s:20:\"totalResultsReturned\";" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "i:2;s:19:\"firstResultPosition\";i:1;s:6:\"Result\";a:2:{i:0;a:10:{s:5:\"Title\";s:12:\"corvette.jpg\";" + "s:7:\"Summary\";s:150:\"bluefirebar.gif<seq2seq4repair_space>03-Nov-2003<seq2seq4repair_space>19:02<seq2seq4repair_space>22k<seq2seq4repair_space>burning_frax.jpg<seq2seq4repair_space>05-Jul-2002<seq2seq4repair_space>14:34<seq2seq4repair_space>169k<seq2seq4repair_space>corvette.jpg<seq2seq4repair_space>" ) + "21-Jan-2004<seq2seq4repair_space>01:13<seq2seq4repair_space>101k<seq2seq4repair_space>coupleblack.gif<seq2seq4repair_space>03-Nov-2003<seq2seq4repair_space>19:00<seq2seq4repair_space>3k\";s:3:\"Url\";" ) + "s:48:\"http:////www.vu.union.edu//~jaquezk//MG//corvette.jpg\";s:8:\"ClickUrl\";" ) + "s:48:\"http:////www.vu.union.edu//~jaquezk//MG//corvette.jpg\";s:10:\"RefererUrl\";" ) + "s:35:\"http:////www.vu.union.edu//~jaquezk//MG\";s:8:\"FileSize\";" ) + "s:7:\"101.5kB\";s:10:\"FileFormat\";s:4:\"jpeg\";s:6:\"Height\";s:3:\"768\";" ) + "s:5:\"Width\";s:4:\"1024\";s:9:\"Thumbnail\";a:3:{s:3:\"Url\";s:42:\"http:////sp1.mm-a1.yimg.com//image//2178288556\";" ) + "s:6:\"Height\";s:3:\"120\";s:5:\"Width\";s:3:\"160\";}}i:1;a:10:{s:5:\"Title\";" ) + "s:23:\"corvette_c6_mini_me.jpg\";s:7:\"Summary\";s:48:\"Corvette<seq2seq4repair_space>I<seq2seq4repair_space>,<seq2seq4repair_space>Corvette<seq2seq4repair_space>II<seq2seq4repair_space>,<seq2seq4repair_space>Diablo<seq2seq4repair_space>,<seq2seq4repair_space>Enzo<seq2seq4repair_space>,<seq2seq4repair_space>Lotus\";" ) + "s:3:\"Url\";s:54:\"http:////www.ku4you.com//minicars//corvette_c6_mini_me.jpg\";s:8:\"ClickUrl\";" ) + "s:54:\"http:////www.ku4you.com//minicars//corvette_c6_mini_me.jpg\";s:10:\"RefererUrl\";" ) + "s:61:\"http:////mik-blog.blogspot.com//2005_03_01_mik-blog_archive.html\";s:8:\"FileSize\";s:4:\"55kB\";" ) + "s:10:\"FileFormat\";s:4:\"jpeg\";s:6:\"Height\";s:3:\"518\";s:5:\"Width\";s:3:\"700\";" ) + "s:9:\"Thumbnail\";a:3:{s:3:\"Url\";s:42:\"http:////sp1.mm-a2.yimg.com//image//2295545420\";" ) + "s:6:\"Height\";s:3:\"111\";s:5:\"Width\";s:3:\"150\";}}}}}" ) ; Map results = ( ( Map ) ( new SerializedPhpParser ( input ) . parse ( ) ) ) ; assertEquals ( 2 , ( ( Map ) ( ( ( Map ) ( results . get ( "ResultSet" ) ) ) . get ( "Result" ) ) ) . size ( ) ) ; } private void assertPrimitive ( String input , Object expected ) throws Exception { } public void testParseStructureWithSpecialChars ( ) throws Exception { } @ SuppressWarnings ( "rawtypes" ) public void testAcceptedAttributeNames ( ) throws Exception { } public void testExceptionWrongArrayLength1 ( ) { } public void testExceptionWrongArrayLength2 ( ) { } public void testExceptionWrongStringLength1 ( ) { } public void testExceptionWrongStringLength2 ( ) { } public void testExceptionMissingEndAfterString1 ( ) { } public void testExceptionMissingEndAfterString2 ( ) { } public void testExceptionMissingEndAfterInteger ( ) { } public void testExceptionMissingEndAfterDouble ( ) { } public void testExceptionWrongObjectLength ( ) { } public void testBugDefectStringWithSpezialChar ( ) { } public void testBug2DefectStringWithSpezialChar ( ) { } private void assertExceptionSimple ( String expectException , String input ) { } }

Fix:
String input = "a:2:{i:0;a:8:{s:5:\"class\";O:7:\"MyClass\":1:{s:5:\"pippo\";s:4:\"test\";}i:0;i:1;i:1;d:0.19999998807907104;i:2;b:1;i:3;b:0;i:4;N;i:5;a:1:{i:0;s:42:\"\";\";\";\";\";AäüÖRÜßÃTÍLÇÅ\";\";\";\";\";\";}i:6;O:6:\"Object\":0:{}}i:1;a:8:{s:5:\"class\";O:7:\"MyClass\":1:{s:5:\"pippo\";s:4:\"test\";}i:0;i:1;i:1;d:0.19999998807907104;i:2;b:1;i:3;b:0;i:4;N;i:5;a:1:{i:0;s:42:\"\";\";\";\";\";AäüÖRÜßÃTÍLÇÅ\";\";\";\";\";\";}i:6;O:6:\"Object\":0:{}}}" ;