Skip to content

Commit 82fc51a

Browse files
marcwNyholm
authored andcommitted
Prevent crash when getting callerName (#120)
* Prevent crash when getting callerName * Code cleanup * Added change log
1 parent 795676d commit 82fc51a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
44

55
## UNRELEASED
66

7+
## 1.7.1
8+
9+
### Fixed
10+
11+
- Error when getting caller name with the `FlashMessage` extractor.
12+
713
## 1.7.0
814

915
### Added

src/Visitor/Php/Symfony/FlashMessage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public function enterNode(Node $node)
3535
}
3636

3737
$name = (string) $node->name;
38+
39+
// This prevents dealing with some fatal edge cases when getting the callerName
40+
if (!in_array($name, ['addFlash', 'add'])) {
41+
return;
42+
}
43+
3844
$caller = $node->var;
3945
// $caller might be "Node\Expr\New_"
4046
$callerName = isset($caller->name) ? (string) $caller->name : '';

0 commit comments

Comments
 (0)