Skip to content

Commit c954087

Browse files
authored
fix: if watch does not start with $ use eval, extra case for self::$ (#1014)
* fix: if watch does not start with $ use eval, extra case for self:: * Changelog
1 parent 942fd4a commit c954087

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [1.36.1]
8+
9+
- Improve handling of watch for static properties
10+
711
## [1.36.0]
812

913
- Implement copy to clipboard in var_export format

src/phpDebug.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,8 +1490,12 @@ class PhpDebugSession extends vscode.DebugSession {
14901490
this.sendResponse(response)
14911491
return
14921492
} else if (args.context === 'watch') {
1493+
// try to translate static variable to special Xdebug format
1494+
if (args.expression.startsWith('self::$')) {
1495+
args.expression = '$this::' + args.expression.substring(7)
1496+
}
14931497
// if we suspect a function call
1494-
if (args.expression.includes('(')) {
1498+
if (!args.expression.startsWith('$') || args.expression.includes('(')) {
14951499
if (stackFrame.level !== 0) {
14961500
throw new Error('Cannot evaluate function calls when not on top of the stack')
14971501
}

0 commit comments

Comments
 (0)