branch: elpa/php-mode
commit c439aac957a1775b1176b2cf20db97830983e84b
Author: USAMI Kenta <[email protected]>
Commit: USAMI Kenta <[email protected]>
Guard match data in error-control operator matcher
`php-in-string-or-comment-p' calls `syntax-ppss', which may trigger
`syntax-propertize' and clobber the match data set by the preceding
`re-search-forward'. That could misplace the `@new' look-ahead check
and the face applied by font-lock. Wrap the call in `save-match-data'
so the matched `@' is preserved.
---
lisp/php-mode.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 07dd4ee411..490ff7b80f 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -1629,7 +1629,10 @@ matcher is set to override that face."
(let (found)
(while (and (not found)
(re-search-forward "@" limit t))
- (unless (or (php-in-string-or-comment-p)
+ ;; `php-in-string-or-comment-p' calls `syntax-ppss', which may run
+ ;; `syntax-propertize' and clobber the match data, so guard it to
+ ;; keep the `@' match for both the `@new' check below and font-lock.
+ (unless (or (save-match-data (php-in-string-or-comment-p))
(save-excursion
(goto-char (match-beginning 0))
(looking-at-p "@new\\_>")))