Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
http://lyften.com/projects/laravel-currency
BSD 2-Clause "Simplified" License
392 stars 137 forks source link

CACHE Error #18

Closed vadimwe closed 8 years ago

vadimwe commented 10 years ago

Strange error on production server... Any ideas? Cache cleanup & clear done.

capture

vadimwe commented 10 years ago

Solved. Required PHP 5.5 for normal usage, if you have PHP < 5.5, change $cache[$currency->code] TO $cache[$currency['code']] etc.

billmn commented 9 years ago

It depends on how you have set the "fetch" key in app/config/database.php.

'fetch' => PDO::FETCH_CLASS,  <-- Returns a StdClass object
'fetch' => PDO::FETCH_ASSOC,  <-- Returns an Array

If result of the query is an array ... Yes you have this error.

billmn commented 9 years ago

What about force $currency to be an object?

foreach ($db->table($table_name)->get() as $currency)
{
    $currency = (object) $currency;

    $cache[$currency->code] = array(
        'id'            => $currency->id,
        'title'         => $currency->title,
        'symbol_left'   => $currency->symbol_left,
...
Torann commented 8 years ago

I've upped the minimum PHP version to 5.5.9.