Skip to content

Commit 30c2388

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #79062
2 parents 5acd86d + 375191a commit 30c2388

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Zend/zend_language_scanner.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,6 +2437,7 @@ skip_escape_conversion:
24372437
24382438
if (is_heredoc && !SCNG(heredoc_scan_ahead)) {
24392439
zend_lex_state current_state;
2440+
zend_string *saved_doc_comment = CG(doc_comment);
24402441
int heredoc_nesting_level = 1;
24412442
int first_token = 0;
24422443
int error = 0;
@@ -2447,6 +2448,7 @@ skip_escape_conversion:
24472448
SCNG(heredoc_indentation) = 0;
24482449
SCNG(heredoc_indentation_uses_spaces) = 0;
24492450
LANG_SCNG(on_event) = NULL;
2451+
CG(doc_comment) = NULL;
24502452
24512453
zend_ptr_stack_reverse_apply(&current_state.heredoc_label_stack, copy_heredoc_label_stack);
24522454
@@ -2496,6 +2498,7 @@ skip_escape_conversion:
24962498
zend_restore_lexical_state(&current_state);
24972499
SCNG(heredoc_scan_ahead) = 0;
24982500
CG(increment_lineno) = 0;
2501+
CG(doc_comment) = saved_doc_comment;
24992502
25002503
if (PARSER_MODE() && error) {
25012504
RETURN_TOKEN(T_ERROR);

ext/reflection/tests/bug79062.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Bug #79062: Property with heredoc default value returns false for getDocComment
3+
--FILE--
4+
<?php
5+
6+
class BugReportMailrcConfigTests
7+
{
8+
/** @var string */
9+
private $s1 = <<<STRING
10+
I'm a string :(
11+
STRING;
12+
/** @var string */
13+
private $s2 = <<<'STRING'
14+
I'm a string :)
15+
STRING;
16+
/** @var string */
17+
private $s3 = 'I\'m a string :)';
18+
}
19+
20+
$ref = new \ReflectionClass(BugReportMailrcConfigTests::class);
21+
$s1 = $ref->getProperty('s1');
22+
var_dump($s1->getDocComment());
23+
24+
$s2 = $ref->getProperty('s2');
25+
var_dump($s2->getDocComment());
26+
27+
$s3 = $ref->getProperty('s3');
28+
var_dump($s2->getDocComment());
29+
30+
?>
31+
--EXPECT--
32+
string(18) "/** @var string */"
33+
string(18) "/** @var string */"
34+
string(18) "/** @var string */"

0 commit comments

Comments
 (0)