Sublime Forum

PHP detection broken in 3103

#1

Bug Description
Since build 3103, files with PHP code (.inc, .module) are not properly recognized.

Steps to Reproduce

  1. Download any Drupal module (e.g. https://www.drupal.org/project/views)
  2. In Sublime Text 3103, open any of the .module or .inc files from the module

Actual Behavior
.module or .inc files are recognized as Plain Text.

Expected Behavior
Files with content starting with <?php are recognized as PHP.


I was under the impression that Sublime could recognize PHP files by analyzing their content. Was this never the case? Were .module and .inc files simply removed from a list of files assumed to be PHP by default?

0 Likes

#2

For me any .php or files starting <?php are parsed as HTHML…

0 Likes

#3

This was never the case until the .sublime-syntax format has been introduced (effectively with the lastest beta build). It would be an easy fix to open files as PHP if they contain <?php in the first line now, however. At this moment, it only matches for a shebang line, e.g. #/usr/bin/php. HTML matches for <!DOCTYPE html and <html btw.

Does anyone of you two have the ApplySyntax package installed?

0 Likes

#4

I don’t have it installed.

0 Likes

#5

I don’t have it installed either.

0 Likes

#6

We’ve already added <?php detection to via https://github.com/sublimehq/Packages/commit/007b2ef9be6ffd69d5bd2097ecf08d9170627d44.

It should be part of the next dev build.

1 Like

#7

Thanks! That’s awesome, also it is really cool to see you now around here, hopefully Sublime becomes more and more updated.

On the other hand… shouldn’t it detect a PHP files when it does a PHP extension? It’s not working for me regardless starting with <?php or not.

0 Likes

#8

Ok, my bad… Apparently I had an HTML syntax specific setting where one of the extensions was PHP.

0 Likes