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

More robust vendor directory detection #2153

Merged
merged 5 commits into from
Dec 30, 2019
Merged

More robust vendor directory detection #2153

merged 5 commits into from
Dec 30, 2019

Conversation

jclaveau
Copy link
Contributor

@jclaveau jclaveau commented Dec 6, 2019

This PR detects the vendor directory based on the presence of autoload.php. This allows the use of COMPOSER_VENDOR_DIR environment variable of Composer when installed as dependency

}

$vendorDir = realpath($vendorDir);
Copy link
Member

Choose a reason for hiding this comment

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

The use of realpath may interfere with running phpDocumentor's PHAR distribution. Realpath will break out of a PHAR file and consult the host filesystem. This is the reason why the original code did not use realpath to clean up the path :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that, thanks. I just added realpath to ease the debug with more readability.

Thanks a lot

Copy link
Member

Choose a reason for hiding this comment

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

No problem, I know this because I did the exact same thing when I originally built this class ;)

Copy link
Member

Choose a reason for hiding this comment

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

I see you rebased the PR but the realpath is still there; do you still have to make the change or did something get lost in the rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to see the failing tests with realpath rebased on master (because your approach for integration tests interests me) but Behat's tests are passing loacally (80 scenarios (80 passed) 283 steps (283 passed)).

I'm surprised they are not run automatically with this PR and I get a warning/error in the Github's actions of my commit:

So I wonder if

  • Behat's is wright locally but wrong in Github's actions?
  • The opposit.
  • The tests you speak about are still not merged in master?

Copy link
Member

Choose a reason for hiding this comment

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

The failing build you are seeing is using the phar which has been built in a step before we execute behat. As @mvriel already said your changes are breaking the phar and not the plain build which is also passing in your linked build.

Does that make it more clear what is going on?

We are still searching for a solution to build the pr on this project as well. So we can see the results in the pr. Main issue is that we don't want to build on pr and push but only one of them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanations. I removed the realpath() call

* @param string $url
* @param string|bool The cleaned url or false if it doesn't exist
*/
function realpath(string $url)
Copy link
Member

Choose a reason for hiding this comment

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

This is unnecessary since realpath should not be used; the vfs filesystem has the same issues as the phar filesystem; with realpath you break out of virtual filesystem

@mvriel
Copy link
Member

mvriel commented Dec 25, 2019

Can you rebase master into this PR? Master contains a more robust build setup that will also test things like the PHAR distribution

@jclaveau
Copy link
Contributor Author

jclaveau commented Dec 28, 2019

@mvriel @jaapio I just removed the realpath() and added the support of COMPOSER_VENDOR_DIR and COMPOSER environment variable with related tests

@jaapio jaapio merged commit ea81490 into phpDocumentor:master Dec 30, 2019
@jaapio
Copy link
Member

jaapio commented Dec 30, 2019

Thanks!

@jclaveau
Copy link
Contributor Author

Thanks for the review and all your work!

@jclaveau jclaveau deleted the more_robust_vendor_detection branch January 24, 2020 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants