summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2013-06-16 15:02:51 -0700
committerStanislav Malyshev <stas@php.net>2013-06-16 15:22:23 -0700
commit2208447d428542960c73cfeceaf52e95ff0ca2d0 (patch)
treefa193b8bf0d826be8a2305f8be89412fa2a4e8d8 /ext/reflection
parent088c18363938a3eaa4a349442240df9994213cee (diff)
downloadphp-git-2208447d428542960c73cfeceaf52e95ff0ca2d0.tar.gz
Fix bug #64936 - clean doc comment state at the beginning and end of the scan
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/tests/bug64936.inc5
-rw-r--r--ext/reflection/tests/bug64936.phpt34
2 files changed, 39 insertions, 0 deletions
diff --git a/ext/reflection/tests/bug64936.inc b/ext/reflection/tests/bug64936.inc
new file mode 100644
index 0000000000..8ba8c89668
--- /dev/null
+++ b/ext/reflection/tests/bug64936.inc
@@ -0,0 +1,5 @@
+<?php
+
+class B {
+
+}
diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt
new file mode 100644
index 0000000000..578dc7e4c0
--- /dev/null
+++ b/ext/reflection/tests/bug64936.phpt
@@ -0,0 +1,34 @@
+--TEST--
+ReflectionMethod::getDocComment() uses left over doc comment from previous scanner run
+--INI--
+opcache.save_comments=1
+opcache.load_comments=1
+--FILE--
+<?php
+
+function strip_doc_comment($c)
+{
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
+}
+
+token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
+
+eval('class A { }'); // Could also be an include of a file containing similar
+
+$ra = new ReflectionClass('A');
+var_dump(strip_doc_comment($ra->getDocComment()));
+
+token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
+
+include('bug64936.inc');
+
+$rb = new ReflectionClass('B');
+var_dump(strip_doc_comment($rb->getDocComment()));
+
+?>
+===DONE===
+--EXPECT--
+bool(false)
+bool(false)
+===DONE===