Bug 353162 - PHP "heredoc" sintax not properly highlighted
Summary: PHP "heredoc" sintax not properly highlighted
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: 16.04.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-25 09:21 UTC by Rafael Linux User
Modified: 2022-07-05 15:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Linux User 2015-09-25 09:21:47 UTC
There is a structure in PHP called "heredoc" http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc that is very usefull to avoid a lot of "echo"es functions in the code.

Kate doesn't recognice the end of the structure.

Could you fix it ?

Thank you

Reproducible: Always

Steps to Reproduce:
1.Create a PHP file
2.Open it with Kate
3.Insert a "heredoc" structure

Actual Results:  
Incorrect highlightning of the code.

Expected Results:  
To recognize the end of the "heredoc" structure.

Example:

username=getUsername($ID);

echo <<<'EOT'
Some HTML code goes here
Hello $username, welcome back!
Some HTML code goes here
EOT;

variable2 = "Code continues"
Comment 1 Buovjaga 2016-06-25 16:24:14 UTC
Confirmed.

Arch Linux 64-bit
Kate 16.04.2
KDE Frameworks 5.23.0
Qt 5.7
xcb wm
Comment 2 Christoph Cullmann 2016-09-06 09:23:04 UTC
Works for me with KF5 based master.
Perhaps I pasted the text wrongly in the editor, if you still can reproduce, please attach a test file.
Comment 3 Ray 2021-09-29 07:52:31 UTC
Works correctly if the closing identifier is at the beginning of the line but not otherwise.
The PHP manual says "Prior to PHP 7.3.0, the closing identifier must begin in the first column of the line."
The syntax highlighting algorithm needs to be updated to remove this requirement.
Comment 4 Bug Janitor Service 2022-06-18 21:27:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/317
Comment 5 Rafael Linux User 2022-06-22 09:42:10 UTC
(In reply to Christoph Cullmann from comment #2)
> Works for me with KF5 based master.
> Perhaps I pasted the text wrongly in the editor, if you still can reproduce,
> please attach a test file.

It seem(In reply to Ray from comment #3)
> Works correctly if the closing identifier is at the beginning of the line
> but not otherwise.
> The PHP manual says "Prior to PHP 7.3.0, the closing identifier must begin
> in the first column of the line."
> The syntax highlighting algorithm needs to be updated to remove this
> requirement.

It seems working for my test example, while end of heredoc is aligned to left margin, as you wrote.
Thank you
Comment 6 Alain Laporte 2022-07-05 15:04:16 UTC
Fixed by https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/317

Will be fixed in KDE Gear 22.08.