Skip to content

Fix "Not enough memory" error on Windows 7 more.com by setting code page.#4595

Merged
gitlost merged 2 commits intomasterfrom
issue-4593
Jan 5, 2018
Merged

Fix "Not enough memory" error on Windows 7 more.com by setting code page.#4595
gitlost merged 2 commits intomasterfrom
issue-4593

Conversation

@gitlost
Copy link
Contributor

@gitlost gitlost commented Jan 3, 2018

Fixes #4593

Sets code page to 1252 if on Windows < 10 and pager is more.com and PHP >= 7.1.

@gitlost gitlost added this to the 1.5.0 milestone Jan 3, 2018
@gitlost gitlost requested a review from a team January 3, 2018 12:15
// For Windows 7 need to set code page to something other than Unicode (65001) to get around "Not enough memory." error with `more.com` on PHP 7.1+.
if ( 'more' === $pager && defined( 'PHP_WINDOWS_VERSION_MAJOR' ) && PHP_WINDOWS_VERSION_MAJOR < 10 && function_exists( 'sapi_windows_cp_set' ) ) {
// Note will also apply to Windows 8 (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832.aspx) but probably harmless anyway.
sapi_windows_cp_set( 1252 ); // `sapi_windows_cp_set()` introduced PHP 7.1. Code page 1252 is the most used so probably the most compat.
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to pick the codepage through an overrideable ENV variable? That way, impacted users can switch if needed.

Copy link
Member

@schlessera schlessera left a comment

Choose a reason for hiding this comment

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

Let's deploy it like this, and keep in mind that Windows 8 might be impacted as a side-effect.

In case we get reports from Windows 8 users, we can still fine-tune the targeting.

@gitlost
Copy link
Contributor Author

gitlost commented Jan 5, 2018

Cool, will merge as soon as Travis stops messing about. Might create a Windows 8 virtualbox and check it out before release if poss...

@gitlost gitlost merged commit 48f41e1 into master Jan 5, 2018
@gitlost gitlost deleted the issue-4593 branch January 5, 2018 14:56
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.

2 participants