/tests/php/scheck/builtins.php

https://github.com/llvm-djk/pfff · PHP · 43 lines · 25 code · 10 blank · 8 comment · 0 complexity · 786aa1e43baf6a8ff1ca247a3b13041a MD5 · raw file

  1. <?php
  2. // Many builtins are now transformed in regular function calls in
  3. // Ast_php_simple. Those functions must then be defined in
  4. // data/php_stdlib/pfff.php otherwise you can get some
  5. // 'Undefined function' errors.
  6. // coupling: see the comment for builtin() in ast_php_simple.ml
  7. function test_builtins() {
  8. //ERROR: undefined function
  9. undefined_function(1);
  10. //ERROR: please avoid dynamic function
  11. eval(1);
  12. $x = 'foo';
  13. //ERROR: please avoid dynamic code, eval_var()
  14. $$x = 1;
  15. $o = new TestDynField();
  16. $fld = 'afield';
  17. $o->$fld = 1;
  18. clone 1;
  19. exit(1);
  20. yield 1;
  21. yield break;
  22. unset($x);
  23. isset($x);
  24. empty($x);
  25. echo 'foo';
  26. print('foo');
  27. @print('foo');
  28. `ls`;
  29. include 'common.php';
  30. echo __FILE__;
  31. }
  32. class TestDynField {
  33. }