Title :
Automated repair of HTML generation errors in PHP applications using string constraint solving
Author :
Samirni, H. ; Schäfer, Max ; Artzi, Shay ; Millstein, Todd ; Tip, Frank ; Hendren, Laurie
Author_Institution :
Comput. Sci. Dept., Univ. of California, Los Angeles, CA, USA
Abstract :
PHP web applications routinely generate invalid HTML. Modern browsers silently correct HTML errors, but sometimes malformed pages render inconsistently, cause browser crashes, or expose security vulnerabilities. Fixing errors in generated pages is usually straightforward, but repairing the generating PHP program can be much harder. We observe that malformed HTML is often produced by incorrect constant prints, i.e., statements that print string literals, and present two tools for automatically repairing such HTML generation errors. PHPQuickFix repairs simple bugs by statically analyzing individual prints. PHPRepair handles more general repairs using a dynamic approach. Based on a test suite, the property that all tests should produce their expected output is encoded as a string constraint over variables representing constant prints. Solving this constraint describes how constant prints must be modified to make all tests pass. Both tools were implemented as an Eclipse plugin and evaluated on PHP programs containing hundreds of HTML generation errors, most of which our tools were able to repair automatically.
Keywords :
Internet; authoring languages; constraint handling; hypermedia markup languages; program debugging; program diagnostics; program testing; Eclipse plugin; HTML generation error automated repair; PHP Web applications; PHPQuickFix; PHPRepair; bug repairing; constant prints; dynamic approach; individual print static analysis; string constraint solving; Browsers; Cascading style sheets; Computer bugs; Databases; HTML; Maintenance engineering; USA Councils; PHP; automated repair; string constraints;
Conference_Titel :
Software Engineering (ICSE), 2012 34th International Conference on
Conference_Location :
Zurich
Print_ISBN :
978-1-4673-1066-6
Electronic_ISBN :
0270-5257
DOI :
10.1109/ICSE.2012.6227186