Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Fix Windows code page support#41113

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.2fromorkan:5.x
May 7, 2021

Conversation

@orkan
Copy link
Contributor

QA
Branch?5.2
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#37385,Fix#35842,Fix#36324,Fix#37495,Fix#37278
LicenseMIT

Corrects previous fixes that dealt with the mojibake problem on Windows where an OEM code page was applied to an input string and then messed with PHP.internal_encoding setting used by the script. This caused strings with different encodings to be displayed on the console output.

Gemorroj reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.x branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@chalasr
Copy link
Member

Thanks for the PR.
This should target the 4.4 branch as the logic is the same there. Can you rebase and change the PR base branch accordingly?

@chalasrchalasr added this to the4.4 milestoneMay 6, 2021
@orkan
Copy link
ContributorAuthor

Well, at first I was thinking the same as the PR guide says all bug fixes should adress 4.4 branch, but here I'm fixing a method that was introduced later in 352aed3

@chalasr
Copy link
Member

Ok got it, yet this patch changes somethig that exists on 4.4:

if (\function_exists('sapi_windows_cp_set')) {
// Codepage used by cmd.exe on Windows to allow special characters (éàüñ).
@sapi_windows_cp_set(1252);
}
.
So I guess we need an equivalent PR for 4.4. It'd be great if you could submit one. Otherwise, no worries, someone else will do (maybe me).

Also, can you fix the CS issues reported by fabbot (see failing CI builds)?

@orkan
Copy link
ContributorAuthor

I think this is beyond my knowledge of git, but applying this fix against 4.4 will result in conflicts with 352aed3 changes... An equivalent would be to not change anything ;)

Btw, I fixed CS issues but why fabbot wants me to remove these lines?

      *      * @param int    $cp Code page in IBM/EBCDIC format      * @param string $in User input-     *-     * @return string      */     private function resetIOCodepage(int $cp, string $in): string     {

@Nyholm
Copy link
Member

If Fabbot suggest to do CS fix on a unrelated line, you should just ignore it.

@orkan
Copy link
ContributorAuthor

It's actually related but where's the problem? Should I add description to the returned string?

@chalasr
Copy link
Member

chalasr commentedMay 6, 2021
edited
Loading

Symfony omits some annotations (@return,@param) when they don't provide more value that type declarations already provide.
Here@return string states something already known thanks to thestring return type, so the patch can be applied :)

@chalasrchalasr modified the milestones:4.4,5.2May 6, 2021
@orkan
Copy link
ContributorAuthor

OK. Got it! Thanks

@nicolas-grekasnicolas-grekas changed the title[Console] Add Windows code page support[Console] Fix Windows code page supportMay 7, 2021
@nicolas-grekasnicolas-grekas changed the base branch from5.x to5.2May 7, 2021 14:24
@nicolas-grekas
Copy link
Member

Thank you@orkan.

@nicolas-grekasnicolas-grekas merged commit53e47b3 intosymfony:5.2May 7, 2021
@fabpotfabpot mentioned this pull requestMay 9, 2021
nicolas-grekas added a commit that referenced this pull requestMay 11, 2021
This PR was submitted for the 5.x branch but it was merged into the 5.2 branch instead.Discussion----------[Console] Fix Windows code page supportMy previous PR#41113 was corrected by `@nicolas`-grekas on3bac7fe. He introduced logical changes in the code which resulted in incorrect behaviour.The basic idea was to restore the I/O codepage as soon as you get console input. And you have to do this even if `fgets()` returns **false**, because otherwise you'll leave the changed codepage for the rest of the script execution - and that's bad!Commits-------044b585 [Console] Fix Windows code page support
@nicolas-grekas
Copy link
Member

PR for 4.4 welcome btw!

@Nyholm
Copy link
Member

Great work@orkan. Thank you and congratulations to your first contribution.

As Nicolas says, could you do a similar PR to the 4.4 branch? Robinsaid the bug exists there to but the logic has been moved around.

@orkan
Copy link
ContributorAuthor

Hi@Nyholm.
Can you describe me please, what's the workflow here? I can see from the git history, that 4.4 is regulary merged into 5.2, right? So, if I remove something in 5.2 that existed in 4.4 and later introduce it again as a PR for 4.4, doesn't it mean it'll show up in 5.2 too?
That's the thing here. I don't want my fix for 4.4 to show up in 5.2... They'll be incompatible!

@Nyholm
Copy link
Member

Of course.

Normally, bug fixes are merged in 4.4 (or the lowest branch they exists in). Every few days we merge 4.4 -> 5.2 -> 5.x.

later introduce it again as a PR for 4.4

I dont understand. We should create a PR to 4.4 to addsetIOCodepage andresetIOCodepage, right?

They'll be incompatible!

Could you elaborate how they are incompatible? I dont really understand.

@fabpotfabpot mentioned this pull requestMay 12, 2021
@orkan
Copy link
ContributorAuthor

orkan commentedMay 13, 2021
edited
Loading

Ok. Nevermind. I pushed fix#41210 for 4.4. "I am going to sit back now and..." see what will be the result code after 4.4 > 5.2

@nicolas-grekas
Copy link
Member

Resolving merge conflicts is our maintainer's duty. This one was easy ;)

orkan reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NyholmNyholmNyholm left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@dunglasdunglasAwaiting requested review from dunglas

@lyrixxlyrixxAwaiting requested review from lyrixx

@wouterjwouterjAwaiting requested review from wouterj

@xabbuhxabbuhAwaiting requested review from xabbuh

@ycerutoycerutoAwaiting requested review from yceruto

Assignees

No one assigned

Projects

None yet

Milestone

5.2

5 participants

@orkan@carsonbot@chalasr@Nyholm@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp