DocumentCode :
2384025
Title :
Are PHP applications ready for Hack?
Author :
Eshkevari, Laleh ; Dos Santos, Fabien ; Cordy, James R. ; Antoniol, Giuliano
Author_Institution :
Dept. of Genie Inf. et Genie Logiciel, Ecole Polytech. de Montreal, Montréal, QC, Canada
fYear :
2015
fDate :
2-6 March 2015
Firstpage :
63
Lastpage :
72
Abstract :
PHP is by far the most popular WEB scripting language, accounting for more than 80% of existing websites. PHP is dynamically typed, which means that variables take on the type of the objects that they are assigned, and may change type as execution proceeds. While some type changes are likely not harmful, others involving function calls and global variables may be more difficult to understand and the source of many bugs. Hack, a new PHP variant endorsed by Facebook, attempts to address this problem by adding static typing to PHP variables, which limits them to a single consistent type throughout execution. This paper defines an empirical taxonomy of PHP type changes along three dimensions: the complexity or burden imposed to understand the type change; whether or not the change is potentially harmful; and the actual types changed. We apply static and dynamic analyses to three widely used WEB applications coded in PHP (WordPress, Drupal and phpBB) to investigate (1) to what extent developers really use dynamic typing, (2) what kinds of type changes are actually encountered; and (3) how difficult it might be to refactor the code to avoid type changes, and thus meet the constraints of Hack´s static typing. We report evidence that dynamic typing is actually a relatively uncommon practice in production PHP programs, and that most dynamic type changes are simple representational changes, such as between strings and integers. We observe that most PHP type changes in these programs are relatively simple, and that the largest proportion of them are easy to refactor to consistent static typing using simple local renaming transformations. Overall, the paper casts doubt on the usefulness of dynamic typing in PHP, and indicates that for many production applications, conversion to Hack´s static typing may not be very difficult.
Keywords :
authoring languages; program debugging; program diagnostics; social networking (online); Drupal; Facebook; Hack static typing; PHP application; Web scripting language; Web sites; WordPress; dynamic analysis; phpBB; static analysis; Arrays; Computer hacking; Facebook; Instruments; Performance analysis; Production; Safety; Dynamic typing; PHP; Type safety;
fLanguage :
English
Publisher :
ieee
Conference_Titel :
Software Analysis, Evolution and Reengineering (SANER), 2015 IEEE 22nd International Conference on
Conference_Location :
Montreal, QC
Type :
conf
DOI :
10.1109/SANER.2015.7081816
Filename :
7081816
Link To Document :
بازگشت