Skip to content

Commit ac40588

Browse files
authored
Merge pull request #3 from JorgenEvens/bug/properly-sanitize-key-values
[apcu] Properly sanitize value of apc key when shown.
2 parents 5beca2e + 5d46a13 commit ac40588

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cache.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
if (!extension_loaded('apcu')) {
33
function apcu_cache_info($limited = false) { return apc_cache_info('user', $limited); }
44
function apcu_sma_info($limited = false) { return apc_sma_info($limited); }
5-
function apcu_fetch($key, &$success) { return apc_fetch($key, $success); }
5+
function apcu_fetch($key, &$success = null) { return apc_fetch($key, $success); }
66
function apcu_delete($key) { return apc_delete($key); }
77
class ApcuIterator extends ApcIterator {}
88
}
@@ -301,7 +301,7 @@ function sort_list(&$list) {
301301
<?php if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_view' ): ?>
302302
<div>
303303
<h3>Value for <?=htmlentities('"'.$_GET['selector'].'"')?></h3>
304-
<pre><?php var_dump( apcu_fetch(urldecode($_GET['selector'])) ); ?></pre>
304+
<pre><?=htmlentities(var_export(apcu_fetch(urldecode($_GET['selector']))), true); ?></pre>
305305
</div>
306306
<?php endif; ?>
307307
<?php if( isset( $_GET['action'] ) && $_GET['action'] == 'apcu_select' ): ?>
@@ -311,7 +311,7 @@ function sort_list(&$list) {
311311
<thead>
312312
<tr>
313313
<th><a href="<?=sort_url(has_key(apcu_ref(), 'key', 'info'))?>">Key</a></th>
314-
<th><a href="<?=sort_url('nhits')?>">Hits</a></th>
314+
<th><a href="<?=sort_url(has_key(apcu_ref(), 'nhits', 'num_hits'))?>">Hits</a></th>
315315
<th><a href="<?=sort_url('mem_size')?>">Size</a></th>
316316
<th><a href="<?=sort_url('ttl')?>">TTL</a></th>
317317
<th>Expires</th>
@@ -327,7 +327,7 @@ function sort_list(&$list) {
327327
if( !preg_match(get_selector(), get_key($item, 'key', 'info')) || $expired ) continue;?>
328328
<tr>
329329
<td><?=get_key($item, 'key', 'info')?></td>
330-
<td><?=$item['nhits']?></td>
330+
<td><?=get_key($item, 'nhits', 'num_hits')?></td>
331331
<td><?=human_size($item['mem_size'])?></td>
332332
<td><?=$item['ttl']?></td>
333333
<td><?=date('Y-m-d H:i', get_key($item, 'mtime', 'modification_time') + $item['ttl'] )?></td>

0 commit comments

Comments
 (0)