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

Appearance settings

Commit 29bc90d

Browse filesBrowse files
gappleGeoff Appleby
authored and
Geoff Appleby
committed
[ClassLoader] Use symfony/polyfill-apcu
1 parent 9d18913 commit 29bc90d
Copy full SHA for 29bc90d

File tree

2 files changed

+7
-7
lines changed
Filter options

2 files changed

+7
-7
lines changed

‎src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ApcUniversalClassLoader extends UniversalClassLoader
7171
*/
7272
public function __construct($prefix)
7373
{
74-
if (!extension_loaded('apc')) {
74+
if (!function_exists('apcu_fetch')) {
7575
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
7676
}
7777

@@ -87,8 +87,8 @@ public function __construct($prefix)
8787
*/
8888
public function findFile($class)
8989
{
90-
if (false === $file = apc_fetch($this->prefix.$class)) {
91-
apc_store($this->prefix.$class, $file = parent::findFile($class));
90+
if (false === $file = apcu_fetch($this->prefix.$class)) {
91+
apcu_store($this->prefix.$class, $file = parent::findFile($class));
9292
}
9393

9494
return $file;

‎src/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
1515

1616
/**
17-
* @requires extension apc
17+
*
1818
*/
1919
class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
2020
{
2121
protected function setUp()
2222
{
2323
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
24-
apc_clear_cache('user');
24+
apcu_clear_cache();
2525
} else {
2626
$this->markTestSkipped('APC is not enabled.');
2727
}
@@ -30,7 +30,7 @@ protected function setUp()
3030
protected function tearDown()
3131
{
3232
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
33-
apc_clear_cache('user');
33+
apcu_clear_cache();
3434
}
3535
}
3636

@@ -39,7 +39,7 @@ public function testConstructor()
3939
$loader = new ApcUniversalClassLoader('test.prefix.');
4040
$loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
4141

42-
$this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apc_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
42+
$this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apcu_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
4343
}
4444

4545
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.