Symptom: intermittent errors in logs, specifically for the db_cache or sessions tables, matching the following patterns:

PHP Fatal error: 1062: Duplicate entry 'zc_xxxxxx' for key 1 :: insert into db_cache set cache_entry_name = 'zc_xxxxxx' ...

PHP Fatal error: 1062: Duplicate entry 'xxxxxx' for key 'PRIMARY' :: insert into sessions ...

NOTE: THIS IS NOT for any general "1062 Duplicate entry" error. This is SPECIFIC to the db_cache and sessions tables. If you've got a "1062 Duplicate entry" message for another table, that is a SEPARATE ISSUE, which you will need to fix separately!


FIX: Apply the code changes shown in BOTH of these posts:
https://github.com/zencart/zencart/pull/244/files
and
https://github.com/zencart/zencart/pull/245/files

(On that site, the text in red is stuff that was removed. Text in green is stuff that was added/changed.
Basically, remove all the lines that are shown as starting with a "-", and replace/add all lines that are shown as starting with a "+". The red and green are just clarifying guides.)



This also affects older versions. The above fixes are included in v1.6.0