October: DB MemoryCache doesn't support Query Expressions

Created on 3 Mar 2017  路  3Comments  路  Source: octobercms/october

Expected behavior

The memory cache functionality added in https://github.com/octobercms/library/pull/253 should work flawlessly with any query.

Actual behavior

Queries that are built on Illuminate\Database\Query\Expressions via $query->addSelect(new Expression($values)); fail hard with Exception: Illegal offset type in October\Rain\Database\MemoryCache->put() on the $this->tableMap[$query->from][] = $hash; line.

Reproduce steps

Utilize the Searchable Trait on any model and then perform a query that triggers that trait. This will replace $query->from with an Expression object that will not be explicitly cast to string for utilizing as an array key in the MemoryCache implementation.

Bug

Most helpful comment

Props to @triasrahman for reporting initially.

All 3 comments

Fix in progress

Props to @triasrahman for reporting initially.

Was this page helpful?
0 / 5 - 0 ratings