Home Download Buy Blog Forum Support

Bug: PHP syntax highlighting failure

Bug: PHP syntax highlighting failure

Postby GreyWyvern on Wed Oct 28, 2009 9:15 pm

PHP syntax highlighting fails on this valid construction:

Code: Select all
<?php
$str = array("Foo", "Bar");
echo "Name: {$str[($str[1]) ? 1 : 0]}"; // Should echo "Name: Bar"
?>

The text "($str[1" appears highlighted as a syntax error (?) and the square brackets on either side are (using colour scheme "Blackboard") highlighted in yellow text. The matchBrackets algorithm successfully finds the correct brackets though.
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia

Re: Bug: PHP syntax highlighting failure

Postby GreyWyvern on Fri Jan 15, 2010 9:59 pm

Here is another valid syntax on which Sublime's PHP highlighting is failing:

Code: Select all
$insert = mysql_query("INSERT INTO `catalogue` SET
  `model`='{$_POST["page_row{$count}_model"]}',
  `type`='{$_POST["page_row{$count}_type"]}',
  `updated`=UNIX_TIMESTAMP()
;");

Two of the odd lines need to be included. The first trips up the second and from then on everything further in the document is treated as a string and coloured accordingly. I'm assuming the nested double-quotes and curly braces are the culprit here.
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia

Re: Bug: PHP syntax highlighting failure

Postby jps on Mon Jan 18, 2010 12:38 pm

As far as I'm aware, these aren't Sublime Text specific issues, but are a general issue with the PHP grammar. Hopefully it'll get fixed upstream in the TextMate repo at some point.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Bug: PHP syntax highlighting failure

Postby GreyWyvern on Fri Jan 22, 2010 9:39 pm

How would I report this to TextMate? Do you import the files directly from them, or do you modify them for use by Sublime Text? I don't have a Mac that I can test TextMate on directly :)

Would they know what I was talking about if I just reported it on their "textmate users" mailing list, the same way I've done here?
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia

Re: Bug: PHP syntax highlighting failure

Postby protoplasm on Fri Jan 22, 2010 10:16 pm

I think they would know what you were talking about, yes. I don't know where the best place for reporting errors is, but the mailing list seems a decent place to start.

For what it's worth, I just tried your snippet in TextMate and, like jps posits, it is the same as in Sublime.
protoplasm
 
Posts: 23
Joined: Tue Oct 20, 2009 4:47 pm

Re: Bug: PHP syntax highlighting failure

Postby GreyWyvern on Fri Jan 22, 2010 10:36 pm

Thanks for the confirmation! :) I made a post on their mailing list.
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 21 guests