Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit f888229

Browse files
committed
Use apcu instead of apc for PHP >= 7
1 parent bb03241 commit f888229

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Check/ApcFragmentation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ public function check()
9090
return new Skip('APC has not been enabled in CLI.');
9191
}
9292

93-
if (! function_exists('apc_sma_info')) {
93+
$memoryAllocationMethod = \PHP_VERSION_ID < 70000 ? 'apc_sma_info' : 'apcu_sma_info';
94+
if (! function_exists($memoryAllocationMethod)) {
9495
return new Warning('APC extension is not available');
9596
}
9697

97-
if (! $info = apc_sma_info()) {
98+
if (! $info = $memoryAllocationMethod()) {
9899
return new Warning('Unable to retrieve APC memory status information.');
99100
}
100101

src/Check/ApcMemory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ public function check()
4646
return new Skip('APC has not been enabled in CLI.');
4747
}
4848

49-
if (! function_exists('apc_sma_info')) {
49+
$memoryAllocationMethod = \PHP_VERSION_ID < 70000 ? 'apc_sma_info' : 'apcu_sma_info';
50+
if (! function_exists($memoryAllocationMethod)) {
5051
return new Warning('APC extension is not available');
5152
}
5253

53-
if (! $this->apcInfo = apc_sma_info()) {
54+
if (! $this->apcInfo = $memoryAllocationMethod()) {
5455
return new Warning('Unable to retrieve APC memory status information.');
5556
}
5657

0 commit comments

Comments
 (0)