Skip to content

fix(cache): delegate legacy Hashtable storage to modern adapter#5

Closed
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/hashtable_caller
Closed

fix(cache): delegate legacy Hashtable storage to modern adapter#5
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/hashtable_caller

Conversation

@TDannhauer

Copy link
Copy Markdown

fix(cache): delegate legacy Hashtable storage to modern adapter

Summary

  • Fix TypeError in ActiveSync and other code paths that use the legacy Horde_Cache API with a modern Horde\HashTable\HashTable backend (e.g. Memcache).
  • When Horde_Core_Factory_Cache injects a PSR-4 Horde\HashTable\HashTable instance, Horde_Cache_Storage_Hashtable now delegates to Horde\Cache\HashtableStorage instead of calling the old array-based get() API.
  • Legacy Horde_HashTable backends are unchanged and still use the existing code path.

Problem

After the FRAMEWORK_6_0 HashTable modernization, Horde\HashTable\Driver\Memcache::get() accepts only a string key. The legacy cache storage adapter still called:

$this->_hash->get($query); // $query is an array

That surfaced during ActiveSync requests via:

Horde_Perms_Sql->exists()Horde_Cache->get()Horde_Cache_Storage_Hashtable->get()Memcache::get(array)

Horde_Core_Factory_Cache already documents routing modern HashTable instances through HashtableStorage, but that was never implemented in the storage class.

Solution

Detect Horde\HashTable\HashTable in _initOb() and wrap it with Horde\Cache\HashtableStorage. Delegate get(), set(), and expire() to that adapter, which correctly uses getMultiple() and the modern TTL API.

Test plan

  • Configure cache driver Hashtable with Memcache backend ($conf['cache']['driver'] = 'Hashtable', $conf['hashtable']['driver'] = 'Memcache').
  • Trigger an ActiveSync request (e.g. mobile device sync or rpc.php ActiveSync endpoint).
  • Confirm no TypeError: Memcache::get(): Argument #1 ($key) must be of type string, array given in Horde logs.
  • Verify cache read/write via legacy adapter:
    $storage = new Horde_Cache_Storage_Hashtable(['hashtable' => $hash, 'prefix' => 'horde']);
    $storage->set('test_key', 'test_value', 3600);
    $storage->get('test_key', 3600); // returns 'test_value'
  • Confirm legacy Horde_HashTable backends still work if used directly.

Horde_Cache_Storage_Hashtable still called get() with an array of keys,
which breaks with Horde\HashTable\HashTable drivers that require a string.
Route modern backends through Horde\Cache\HashtableStorage so ActiveSync
and other cache users work with Memcache again.
@TDannhauer TDannhauer requested a review from ralflang June 9, 2026 09:38
@ralflang

ralflang commented Jun 9, 2026

Copy link
Copy Markdown
Member

Mind #4 and related horde/Core#131

@ralflang

ralflang commented Jun 9, 2026

Copy link
Copy Markdown
Member

Superseded by 3.0.0RC2 a4ebb16

@ralflang ralflang closed this Jun 9, 2026
@TDannhauer TDannhauer deleted the fix/hashtable_caller branch June 13, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants