Ticket #287 (new defect)

Opened 9 months ago

eaccelerator_list_keys is keeping ':' from namespace/hostname prefixing as part of key

Reported by: hkmaly Assigned to: somebody
Priority: minor Milestone:
Component: eAccelerator Version: 0.9.5
Keywords: eaccelerator_list_keys Cc: hkmaly@bigfoot.com

Description

When using namespace or hostname (which, BTW, I don't know how to not use), keys are prefixed with its value and ':' (in version 0.9.5.2 it's on lines 65 and 79 in file cache.c, function build_key).

When fetching keys by function eaccelerator_list_keys, the value is removed (line 629) but ':' is copied to output, so every key returned from eaccelerator_list_keys have ':' before name.

I would suppose names returned from eaccelerator_list_keys should be used as arguments to eaccelerator_get, which don't work now.

Example:

<?php

  eaccelerator_put('Test_key','test_value',100);
  eaccelerator_put(':Test_key','second_test_value',100);
  $keys = eaccelerator_list_keys();
  foreach($keys as $k=>$v) {
    echo "Key: {$v['name']}, value ".eaccelerator_get($v['name'])."<br>\n";
  }
 ?>

Expected results:

Key: :Test_key, value second_test_value
Key: Test_key, value test_value

Real results:

Key: ::Test_key, value
Key: :Test_key, value second_test_value