【24h】

Are PHP applications ready for Hack?

机译:PHP应用程序是否准备好了攻击?

获取原文

摘要

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.
机译:PHP是迄今为止最受欢迎的Web脚本语言,占现有网站的80%以上。 PHP是动态键入的,这意味着变量占据它们分配的对象的类型,并且可以将类型更改为执行所得。虽然某些类型的变化可能没有有害,但是涉及函数调用和全局变量的其他变化可能更难以理解和许多错误的来源。 Hack是Facebook认可的新的PHP变体,尝试通过向PHP变量添加静态键入来解决此问题,这将它们限制在整个执行中的单一一致类型。本文定义了PHP型沿三维变化的经验分类:理解类型变化的复杂性或负担;改变是否可能有害;并且实际类型发生了变化。我们将静态和动态分析应用于在PHP(WordPress,Drupal和PHPBB)中编码的三种广泛使用的Web应用程序来调查(1)开发人员真正使用动态键盘的程度,(2)实际遇到了哪些类型的变化; (3)重构代码有多难以避免类型更改,因此符合Hack的静态键入的约束。我们报告了动态键入实际上是生产PHP程序中相对罕见的实践,并且大多数动态类型的变化是简单的代表性变化,例如字符串和整数。我们观察到这些程序中的大多数PHP类型的更改相对简单,并且它们的最大比例易于重构,以使用简单的本地重命名转换一致的静态键入。总的来说,该论文对PHP动态打字的有用性表示怀疑,并表示对于许多生产应用,转换为Hack的静态打字可能并不是很困难。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号