Skip to content

[Debug] Replaced logic for detecting filesystem case sensitivity #18130

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

Closed
wants to merge 4 commits into from

Conversation

blowski
Copy link

@blowski blowski commented Mar 12, 2016

Q A
Branch 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR none

When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'.

@wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system.

I ran the tests in the following environments:

  • Virtualbox/Vagrant - OSX Host, Ubuntu guest
  • Virtualbox/Vagrant - OSX Host, Windows guest
  • OSX native
  • Ubuntu native

NB - I didn't run it on native Windows (because I don't have easy access to one).

When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the `Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch` failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'.

@wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system.

I ran the tests in the following environments:
* Virtualbox/Vagrant - OSX Host, Ubuntu guest
* Virtualbox/Vagrant - OSX Host, Windows guest
* OSX native
* Ubuntu native

NB - I _didn't_ run it on native Windows (because I don't have easy access to one).
When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the `Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch` failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'.

@wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system.

I ran the tests in the following environments:
* Virtualbox/Vagrant - OSX Host, Ubuntu guest
* Virtualbox/Vagrant - OSX Host, Windows guest
* OSX native
* Ubuntu native

NB - I _didn't_ run it on native Windows (because I don't have easy access to one).
When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the `Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch` failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'.

@wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system.

I ran the tests in the following environments:
* Virtualbox/Vagrant - OSX Host, Ubuntu guest
* Virtualbox/Vagrant - OSX Host, Windows guest
* OSX native
* Ubuntu native

NB - I _didn't_ run it on native Windows (because I don't have easy access to one).
@javiereguiluz
Copy link
Member

@blowski thanks for this contribution! I'm afraid that there is a problem with your code: you use the short array syntax. This is obviously right for modern PHP code, but we decided to not use it on Symfony.

The reason is that our existing code uses the old array syntax and updating it would require a lot of work. If we don't update the old code but use the new syntax in the new code, the result will be a mess. so let's use the old syntax everywhere. Thanks!

@blowski
Copy link
Author

blowski commented Mar 12, 2016

@javiereguiluz I'm blaming that one on PHPStorm. Third time lucky!

if(!file_exists(strtolower(__FILE__))) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif(realpath(strtolower(__FILE__)) === realpath(__FILE__)) {
Copy link
Member

Choose a reason for hiding this comment

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

No need for the second realpath, __FILE__ already has it

@nicolas-grekas
Copy link
Member

👍 with one minor comment

@nicolas-grekas
Copy link
Member

Thank you @blowski.

nicolas-grekas added a commit that referenced this pull request Mar 13, 2016
…tivity (Dan Blows)

This PR was squashed before being merged into the 2.7 branch (closes #18130).

Discussion
----------

[Debug] Replaced logic for detecting filesystem case sensitivity

| Q             | A
| ------------- | ---
| Branch        | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

When I cloned the master branch onto a Virtualbox Vagrant OSX El Capitan host, Ubuntu Wily guest, the `Symfony\Component\Debug\Tests\DebugClassLoaderTest::testFileCaseMismatch` failed because 'Failed asserting that exception of type "\RuntimeException" is thrown'.

@wouterj confirmed he got the same problem, and it's because Virtualbox shared folders aren't case sensitive, even when the guest is using a case sensitive filesystem. So I've replaced the logic that looked at the name of the operating system.

I ran the tests in the following environments:
* Virtualbox/Vagrant - OSX Host, Ubuntu guest
* Virtualbox/Vagrant - OSX Host, Windows guest
* OSX native
* Ubuntu native

NB - I _didn't_ run it on native Windows (because I don't have easy access to one).

Commits
-------

2e81b0a [Debug] Replaced logic for detecting filesystem case sensitivity
@wouterj
Copy link
Member

wouterj commented Mar 13, 2016

Congratz @blowski with your first contribution to Symfony!

@javiereguiluz
Copy link
Member

Congrats @blowski! This was definitely not a simple change for being the first contribution! Thanks.

This was referenced Mar 25, 2016
@alexchip64
Copy link

I think this resolution has created a problem in Windows, see
[DebugClassLoader] Version 2.8.4 loops endlessly at line 292 of DebugClassLoader.php in Windows 7 #18344

if(!file_exists(strtolower(__FILE__))) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
Copy link
Member

Choose a reason for hiding this comment

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

this logic would also break when the Debug component is installed inside a phar

@fabpot fabpot mentioned this pull request Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants