Fix bug #64936 - clean doc comment state at the beginning and end of the scan

This commit is contained in:
Stanislav Malyshev 2013-06-16 15:02:51 -07:00
parent 088c183639
commit 2208447d42
6 changed files with 389 additions and 342 deletions

2
NEWS
View File

@ -6,6 +6,8 @@ PHP NEWS
. Fixed bug #64988 (Class loading order affects E_STRICT warning). (Laruence)
. Fixed bug #64966 (segfault in zend_do_fcall_common_helper_SPEC). (Laruence)
. Fixed bug #64960 (Segfault in gc_zval_possible_root). (Laruence)
. Fixed bug #64936 (doc comments picked up from previous scanner run). (Stas,
Jonathan Oddy)
. Fixed bug #64934 (Apache2 TS crash with get_browser()). (Anatol)
- DateTime:

File diff suppressed because it is too large Load Diff

View File

@ -256,6 +256,7 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
CG(heredoc) = NULL;
CG(heredoc_len) = 0;
}
RESET_DOC_COMMENT();
}
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
@ -539,6 +540,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
CG(zend_lineno) = 1;
}
RESET_DOC_COMMENT();
CG(increment_lineno) = 0;
return SUCCESS;
}
@ -689,6 +691,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
zend_set_compiled_filename(filename TSRMLS_CC);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
RESET_DOC_COMMENT();
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Wed Mar 27 23:52:29 2013 */
/* Generated by re2c 0.13.5 on Sun Jun 16 14:52:22 2013 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {

View File

@ -0,0 +1,5 @@
<?php
class B {
}

View File

@ -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===