bug64936.phpt 808 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. ReflectionMethod::getDocComment() uses left over doc comment from previous scanner run
  3. --EXTENSIONS--
  4. tokenizer
  5. --INI--
  6. opcache.save_comments=1
  7. --FILE--
  8. <?php
  9. function strip_doc_comment($c)
  10. {
  11. if (!strlen($c) || $c === false) return $c;
  12. return trim(substr($c, 3, -2));
  13. }
  14. token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
  15. eval('class A { }'); // Could also be an include of a file containing similar
  16. $ra = new ReflectionClass('A');
  17. var_dump(strip_doc_comment($ra->getDocComment()));
  18. token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
  19. include('bug64936.inc');
  20. $rb = new ReflectionClass('B');
  21. var_dump(strip_doc_comment($rb->getDocComment()));
  22. ?>
  23. --EXPECT--
  24. bool(false)
  25. bool(false)