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

Hackificator tries to hackify PHARs #3710

Closed
simonwelsh opened this issue Sep 10, 2014 · 11 comments
Closed

Hackificator tries to hackify PHARs #3710

simonwelsh opened this issue Sep 10, 2014 · 11 comments

Comments

@simonwelsh
Copy link
Contributor

Running the Hackificator in a folder that contains a phar causes it to try to convert the phar to Hack. Given that a phar tends to be a binary file, this fails rather spectularily.

@jwatzman
Copy link
Contributor

Whoops, good catch! Not something I'm sure we'll have time to get to, but would be happy to accept a PR for this.

@ghost
Copy link

ghost commented Nov 14, 2014

I'll work on that.

@steelbrain
Copy link
Contributor

@lucastadeu, any updates?

@Stelian
Copy link
Contributor

Stelian commented Jan 16, 2015

@lucastadeu are you still looking into this? I have some available time and could submit a PR for this.

@paulbiss
Copy link
Contributor

Doubtful. @Stelian if you want to take over that would be awesome!

@Stelian
Copy link
Contributor

Stelian commented Jan 17, 2015

@paulbiss Will have a look at it today and come up with a PR

@Stelian
Copy link
Contributor

Stelian commented Jan 17, 2015

@paulbiss I need a little help here. The problem originates in https://github.com/facebook/pfff/blob/master/lang_php/parsing/lib_parsing_php.ml#L40 that also evaluates phars to true.

There are two ways of fixing this: one would be to add another function like is_php_not_phar that would be called either in is_php_file or in find_source_files_of_dir_or_files; the other one would be to just change the is_php_script itself to exclude phars.

Since I do not know of all the usage of the lib_parsing_php around, not sure which approach would be the sensitive one.

@paulbiss
Copy link
Contributor

@Stelian I would avoid modifying the behavior of is_php_script, but @jwatzman knows this code much better than I do, so he might be able to shed some light on the cleanest approach here. Thanks for digging into this!

@jwatzman
Copy link
Contributor

Given that pfff can't parse phar files anyways, I think modifying the behavior of is_php_file makes the most sense. I'm pretty sure I have permission to merge code into the pfff repo -- can you send a PR over there?

@Stelian
Copy link
Contributor

Stelian commented Jan 20, 2015

@jwatzman I created a PR at facebookarchive/pfff#105 but I am not sure how to add tests to that particular usecase. I did test it on my box and it worked, but some automation would help.

@simonwelsh
Copy link
Contributor Author

This appears to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants