-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Set $_SERVER['SCRIPT_NAME'] within proxy command #11562
Conversation
@@ -359,6 +359,11 @@ public function url_stat(\$path, \$flags) | |||
|
|||
$globalsCode | |||
$streamProxyCode | |||
|
|||
if (__FILE__ === realpath(\$_SERVER['SCRIPT_NAME'])) { | |||
\$_SERVER['SCRIPT_NAME'] = $binPathExported; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do a realpath on $binPathExported I think otherwise you end up with a relative path which would not be the full path, but maybe that's fine too I guess SCRIPT_NAME isn't guaranteed to be canonical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered about this while writing the code for this. From what I can tell, SCRIPT_NAME holds the same path that was used on the command line.
The documentation for $_SERVER
says that SCRIPT_NAME contains a "path" whereas __FILE__
contains a "full path". I don't know if difference in terms there is intentional or significant.
Contains the current script's path. This is useful for pages which need to point to themselves. The
__FILE__
constant contains the full path and filename of the current (i.e. included) file.
I've updated the pull request to use realpath()
as requested.
5b421ad
to
9dd1cf9
Compare
Thanks |
@Seldaek out of curiosity: I guess there are plans to make a new release where this change is also included. Any ETA for that release? Thank you in advance. |
@Wulfheart yes, I'll try asap, life is a bit hectic at the moment tho, but definitely my next target is a 2.6.0 release :) |
@Seldaek thanks for your response. Glad that it is on the table and not in the far future. |
)" This reverts commit 9c25633.
I had to revert this due to #11617 - it was a hacky attempt at fixing it and well it backfired as these things often do. So I think the best is to just call the phar directly as per sebastianbergmann/phpunit#5447 (comment) - or someone sends a PR detecting the Composer bin proxy and also allowing that for execution of the phar. This is detectable by checking for presence of the global |
Fixes: #11555
Fixes: sebastianbergmann/phpunit#5447
This produces something like the following. This specific example has been taken from the test suite.