GrahamCampbell/Laravel-GitHub

Issue using this package with an application phar

orediggerco opened this issue · 5 comments

Hey there. Thanks for this package (and all your others)! Definitely has made my life easier interacting with github.

I'm working on a new project at the moment with Laravel-Zero, and am running into a problem when the application is built into a phar.

In the GithubServiceProvider, while attempting to merge the config files, there's a call to realpath() which it appears does not play nice, on purpose, with phars. Here's what I'm seeing:

Line in question is 47:
$source = realpath(__DIR__.'/../config/github.php');

Since the path starts with phar://, realpath treats this as an error and returns false. Then when it tries to require that file, I get this error:

PHP Warning:  require(): Filename cannot be empty in phar:///path/to/project/builds/application.phar/vendor/illuminate/support/ServiceProvider.php on line 62

And the top of the stacktrace:

#0  Illuminate\Support\ServiceProvider->mergeConfigFrom(, github) called at [phar:///path/to/project/builds/application.phar/vendor/graham-campbell/github/src/GitHubServiceProvider.php:59]
#1  GrahamCampbell\GitHub\GitHubServiceProvider->setupConfig() called at [phar:///path/to/project/builds/application.phar/vendor/graham-campbell/github/src/GitHubServiceProvider.php:37]

I tested by removing the call to realpath, and the source variable became phar:///path/to/project/builds/application.phar/vendor/graham-campbell/github/src/../config/github.php. With this change, the config file is required just fine.

I'm not sure that just simply removing the call to realpath is the real solution here, perhaps a check if it's false after the call, but I wanted to see if you have run into this before, and what you think about it?

Thanks!
-Adam

Thanks. This is a known bug actually. I do have a work around for this, but I'm yet to roll it out to all my packages. I'll take a look at doing that tomorrow.

Sorry for the delay. A fix is coming soon.

Fixed in v6.2.1. :)

Thank you so much! And happy new year!