Bug 360224 - syntax highlighting not working when PHP inset is in JS function
Summary: syntax highlighting not working when PHP inset is in JS function
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-07 20:56 UTC by Steve V.
Modified: 2019-01-13 07:32 UTC (History)
2 users (show)

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


Attachments
Screenshot of syntax highlighting with the error (9.48 KB, image/png)
2016-03-07 21:00 UTC, Steve V.
Details
Screenshot of syntax highlighting with PHP inset commented out (9.39 KB, image/png)
2016-03-07 21:01 UTC, Steve V.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve V. 2016-03-07 20:56:22 UTC
As soon as I put a PHP inset into a javascript function the syntax highlighting breaks from this point on downwards, screwing the syntax highligting for the rest of the file.

Reproducible: Always

Steps to Reproduce:
Minimum example:

<!DOCTYPE html>
<html>
<head>
  <script>
  function someJSFunc()
  {
<?php
  $var1 = 1;    
?>
  }
  </script>
</head>
</html>

Actual Results:  
The opening tag <?php is not recognised in syntax highlighting and the rest down is not recognised either in the minimal example, probably as a result of the first missed <?php tag. For the part above tag <?php syntax highlighting is working normally. 

As soon as the PHP-inset is deleted or commented out the syntax highlighting is again working.

Expected Results:  
The PHP-inset should be detected and syntax highlighting working. 

Happens for
KWrite
Version 4.14.3
Under KDE 4.14.9

OS: OpenSuse 13.2, 64 bit

Does not occur for OpenSuse 13.1 and KWrite version 4.11.5
Comment 1 Steve V. 2016-03-07 21:00:42 UTC
Created attachment 97752 [details]
Screenshot of syntax highlighting with the error
Comment 2 Steve V. 2016-03-07 21:01:53 UTC
Created attachment 97753 [details]
Screenshot of syntax highlighting with PHP inset commented out
Comment 3 Buovjaga 2016-07-01 11:08:10 UTC
I confirm the result when using HTML highlighting.

Arch Linux 64-bit
Kate 16.04.2
KDE Frameworks 5.23.0
Qt 5.7
xcb wm
Comment 4 Grzegorz Szymaszek 2019-01-12 17:33:31 UTC
I cannot reproduce this bug (i.e. syntax highlighting works correctly) under Frameworks 5.51 (Debian testing) and 5.54, using Qt 5.11.3 in both cases. It’s probably fixed, though I don’t know the exact commit.
Comment 5 Buovjaga 2019-01-12 20:14:25 UTC
(In reply to gszymaszek from comment #4)
> I cannot reproduce this bug (i.e. syntax highlighting works correctly) under
> Frameworks 5.51 (Debian testing) and 5.54, using Qt 5.11.3 in both cases.
> It’s probably fixed, though I don’t know the exact commit.

Did you set highlighting to "HTML"? I still repro on Arch Linux.

Kate 18.12.1
KDE Frameworks 5.53.0
Qt 5.12.0
Comment 6 Grzegorz Szymaszek 2019-01-12 20:57:43 UTC
No, I use “PHP (HTML)”. And it probably should be used in this case. KWrite may choose wrong language if the extension is html (not php/phtml).
Comment 7 Buovjaga 2019-01-13 07:32:22 UTC
(In reply to gszymaszek from comment #6)
> No, I use “PHP (HTML)”. And it probably should be used in this case. KWrite
> may choose wrong language if the extension is html (not php/phtml).

Ok, then it was a user error. Closing.