summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2013-06-16 15:29:25 -0700
committerStanislav Malyshev <stas@php.net>2013-06-16 15:29:25 -0700
commitac343d5c1f8de884921d8acddb2cc81227674615 (patch)
tree8c84c0c0b5b2ec8279177b64a6dca6f35e885d52 /ext/reflection/tests
parent3625b83aaa242c7c6aff045c03203a1b195bc310 (diff)
parent2208447d428542960c73cfeceaf52e95ff0ca2d0 (diff)
downloadphp-git-ac343d5c1f8de884921d8acddb2cc81227674615.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix bug #64936 - clean doc comment state at the beginning and end of the scan ws fix Conflicts: Zend/zend_language_scanner.c Zend/zend_language_scanner.l Zend/zend_language_scanner_defs.h
Diffstat (limited to 'ext/reflection/tests')
-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===