-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ClassLoader] Use symfony/polyfill-apcu #17358
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
Conversation
586b9d5
to
ced974c
Compare
👍 |
Shouldn't tests be updated as well? |
@jakzal this test class does not exist in 2.3, but yes you're right |
@@ -67,7 +67,7 @@ class ApcClassLoader | |||
*/ | |||
public function __construct($prefix, $decorated) | |||
{ | |||
if (!extension_loaded('apc')) { | |||
if (!ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a potential bc break for people who installed apc but didn't enable it. And I don't feel like it's the classes responsibility to check if apc is enabled. it should only make sure the methods can be called, i.e how it was before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated using if (!function_exists('apcu_fetch')) {
@@ -67,7 +67,7 @@ class ApcClassLoader | |||
*/ | |||
public function __construct($prefix, $decorated) | |||
{ | |||
if (!extension_loaded('apc')) { | |||
if (!function_exists('apcu_fetch')) { | |||
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO "enabled" should be replaced by "installed"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's go for "installed"
Thank you @nicolas-grekas. |
This PR was merged into the 2.3 branch. Discussion ---------- [ClassLoader] Use symfony/polyfill-apcu | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Fixes APC usage on PHP 7 or when APCu bc-layer is disabled Commits ------- 623595f [ClassLoader] Use symfony/polyfill-apcu
This PR was merged into the 2.3 branch. Discussion ---------- [ClassLoader] Use symfony/polyfill-apcu | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - #17358 updated ApcClassLoader to use polyfill-apcu, but not ApcUniversalClassLoader 2.7 / 2.8 tests are in LegacyApcUniversalClassLoaderTest Commits ------- a0dc399 [ClassLoader] Use symfony/polyfill-apcu
Fixes APC usage on PHP 7 or when APCu bc-layer is disabled