Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] Fix the build on windows (with mbstring extension missing) #18029

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 2 commits into from

Conversation

jakzal
Copy link
Contributor

@jakzal jakzal commented Mar 6, 2016

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

An alternative approach to #16656 that works without the mbstring extension. If we tried to follow the current approach and make it work without mbstring it would make code quite more complex.

@jakzal
Copy link
Contributor Author

jakzal commented Mar 6, 2016

Hm.. the issue is not fully fixed just yet.

Before the build was failing with two errors:

Testing src/Symfony/Component/HttpFoundation
..............................E..
Fatal error: Call to undefined function Symfony\Component\HttpFoundation\mb_detect_encoding() in C:\projects\symfony\src\Symfony\Component\HttpFoundation\BinaryFileResponse.php on line 164
PHP Fatal error:  Call to undefined function Symfony\Component\HttpFoundation\mb_detect_encoding() in C:\projects\symfony\src\Symfony\Component\HttpFoundation\BinaryFileResponse.php on line 164
KO src/Symfony/Component/HttpFoundation
1) Symfony\Component\HttpFoundation\Tests\BinaryFileResponseTest::testConstructWithNonAsciiFilename
Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "C:\projects\symfony\src\Symfony\Component\HttpFoundation\Tests/Fixtures/föö.html" does not exist

C:\projects\symfony\src\Symfony\Component\HttpFoundation\File\File.php:37
C:\projects\symfony\src\Symfony\Component\HttpFoundation\BinaryFileResponse.php:93
C:\projects\symfony\src\Symfony\Component\HttpFoundation\BinaryFileResponse.php:52
C:\projects\symfony\src\Symfony\Component\HttpFoundation\Tests\BinaryFileResponseTest.php:39

With this PR it only fails with the second one.

@xabbuh I'm not sure why it was earlier implemented with a loop through all the characters. Perhaps you could give some more insights?

@wouterj
Copy link
Member

wouterj commented Mar 6, 2016

Any reason not to use https://github.com/symfony/polyfill-mbstring as it provides a polyfill for the mb functions used here?

@jakzal
Copy link
Contributor Author

jakzal commented Mar 6, 2016

@wouterj that's an option indeed

A file with non-ascii characters in the name needs to be created from PHP
in order for it to be read properly on all platforms.
@jakzal
Copy link
Contributor Author

jakzal commented Mar 6, 2016

Tests fixed. Just bare in mind this is an alternative to #18030.

status: needs review

@jakzal
Copy link
Contributor Author

jakzal commented Mar 6, 2016

Actually, this will only work with unicode, while the existing solution supports all available encodings.

@jakzal jakzal closed this Mar 6, 2016
@jakzal jakzal deleted the binary-file-response-windows-tests branch March 6, 2016 18:07
nicolas-grekas added a commit that referenced this pull request Mar 7, 2016
…ll (jakzal)

This PR was squashed before being merged into the 2.3 branch (closes #18030).

Discussion
----------

[HttpFoundation] Add a dependency on the mbstring polyfill

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

Alternative for #18029.

Commits
-------

59b9f15 [HttpFoundation] Add a dependency on the mbstring polyfill
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.

3 participants