Skip to content

realpath not work in phar #93

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

Merged
merged 1 commit into from
Feb 4, 2016
Merged

realpath not work in phar #93

merged 1 commit into from
Feb 4, 2016

Conversation

nickfan
Copy link
Contributor

@nickfan nickfan commented Jan 19, 2016

i have pack some lumen project into phar executable toolkit.
realpath will not work in phar

btw:
you can detect current code is work in phar mode:

if(Phar::running(false)!='')
{
  // running with phar
}else{
  // no running with phar
}

@@ -26,7 +26,8 @@ class AwsServiceProvider extends ServiceProvider
*/
public function boot()
{
$source = realpath(__DIR__ . '/../config/aws.php');
$source = __DIR__.'/../config/aws.php';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of realpath you could use dirname to walk up the directory tree a level? Something like:

$source = implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'config', 'aws.php']);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mess about with DIRECTORY_SEPARATOR tbh. PHP internally normalizes it when it's used in php's internal functions.

@jeskew
Copy link
Contributor

jeskew commented Jan 19, 2016

Thanks! Could you squash the commits and remove the commented-out code?

@GrahamCampbell
Copy link
Contributor

👎

@GrahamCampbell
Copy link
Contributor

Lumen itself already relies on the realpath function so this makes no sense.

@jeskew jeskew added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jan 19, 2016
@jeskew
Copy link
Contributor

jeskew commented Jan 21, 2016

@GrahamCampbell You can call realpath from inside of a phar, but you can't call it on files that are in a phar. The few instances of realpath in Lumen do not necessarily point into a phar, whereas the line changed in this PR does.

@nickfan
Copy link
Contributor Author

nickfan commented Jan 22, 2016

i removed the commented-out code.
in your lumen project you can set basepath in bootstrap\app.php
and you can customize your view config file in your project ,so far you can bypass realpath in your lumen project.
it's useful for to pack the project into phar executable toolkit in some situation.
laravel framework require symfony/finder, and it's rely on \SplFileInfo::getRealPath same as realpath function,
so lumen framwork is the only option left.

@jeskew
Copy link
Contributor

jeskew commented Jan 27, 2016

@nickfan Can you use dirname instead of ../ and squash the commits?

@nickfan
Copy link
Contributor Author

nickfan commented Jan 30, 2016

i replace ../ with dirname , i'm not so familiar about squash commits,is that ok?

@jeskew
Copy link
Contributor

jeskew commented Feb 3, 2016

GitHub has a guide on squashing commits that you can take a look at.

@nickfan
Copy link
Contributor Author

nickfan commented Feb 4, 2016

ok all done.

@jeskew
Copy link
Contributor

jeskew commented Feb 4, 2016

Thanks!

jeskew added a commit that referenced this pull request Feb 4, 2016
realpath not work in phar
@jeskew jeskew merged commit 84277cd into aws:master Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy