Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some PHP files detected as Hacklang #4229

Closed
3 of 4 tasks
theel0ja opened this issue Aug 14, 2018 · 14 comments
Closed
3 of 4 tasks

Some PHP files detected as Hacklang #4229

theel0ja opened this issue Aug 14, 2018 · 14 comments

Comments

@theel0ja
Copy link

Preliminary Steps

Please confirm you have...

Problem Description

screen shot 2018-08-14 at 13 59 52

URL of the affected repository:

https://github.com/theel0ja/IPLookup/blob/fc18200e8678a3cc9fc071ecd6be10c8b95a3a10/src/add-to-flagfox.php

Last modified on:

2018-08-04

Expected language:

PHP

Detected language:

Hack

@pchaigno
Copy link
Contributor

pchaigno commented Aug 14, 2018

Thanks for the report.

Hack files can also use the .php extension. Since Linguist considers each file independently and that file only contains HTML code, it's going to be difficult (impossible?) for Linguist to understand that it is not a Hack file. You can use an override to change that behavior though.

@theel0ja
Copy link
Author

I mean it detects PHP files that contain only HTML as Hack files

@pchaigno
Copy link
Contributor

Yep, .php files can be either PHP or Hack since both languages use that extension. Linguist usually relies on the content to distinguish between the two. Since the file contains only HTML code, it fails to do so properly.

mdccg referenced this issue in mdccg/if-maker Aug 17, 2019
@Arkanic
Copy link

Arkanic commented Aug 22, 2019

hey
i have this problem
https://github.com/Arkanic/warriorcats

@lildude
Copy link
Member

lildude commented Aug 22, 2019

@Arkanic #4229 (comment) applies to your case too.

@iMaz1n
Copy link

iMaz1n commented Nov 3, 2019

hey
i have this problem
https://github.com/Arkanic/warriorcats

cause you created a php file that doesn't contain php code, so you need to add some php code

@yannikbloscheck
Copy link

Yep, .php files can be either PHP or Hack since both languages use that extension. Linguist usually relies on the content to distinguish between the two. Since the file contains only HTML code, it fails to do so properly.

If it can't really decide based on the content, the fallback language should still be the far more popular and original language for that file extension. This is PHP and not Hack. I find the current behaviour very confusing. Took me some time to finally find this issue with an explanation.

@Hnnx
Copy link

Hnnx commented Jun 21, 2020

I don't mind, it makes me look like I'm using some super secret language while.
Also experiencing this on certain .php files

@geraldelorm
Copy link

Thank you

@iotstudent
Copy link

Thanks for this explanation

@przemub
Copy link

przemub commented Oct 25, 2020

Should not it be detected as HTML then? What Hack has to do with this?

@ismailalabou
Copy link

ismailalabou commented Dec 11, 2020

helpful

@pierreminiggio
Copy link

Hello !
Same issue on this private repo : https://github.com/pierreminiggio/kevin

@luisfelipesdn12
Copy link

Now overrides documentation is in: https://github.com/github/linguist/blob/master/docs/overrides.md

@github-linguist github-linguist locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests