There appears to be a reproducible problem with the way Zen Cart 1.3.6 handles the database cache. I discovered this while trying to write a custom shipping module. I have included a generic shipping module that should be able to reproduce the problem.
--- THE PROBLEM ---
When a shipping module is installed that enters a large number of keys (more than 250) into the “Configuration” table, accessing any of the products pages in the catalog returns the following errors.
Warning: Variable passed to each() is not an array or object in /home/turfmach/public_html/catalog_test/includes/classes/db/mysql/query_factory.php on line 114Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/turfmach/public_html/catalog_test/includes/classes/db/mysql/query_factory.php:114) in /home/turfmach/public_html/catalog_test/includes/functions/sessions.php on line 102Warning: Cannot modify header information - headers already sent by (output started at /home/turfmach/public_html/catalog_test/includes/classes/db/mysql/query_factory.php:114) in /home/turfmach/public_html/catalog_test/includes/init_includes/init_templates.php on line 78These errors are only returned when the SQL_CACHE_METHOD in the following files are set to “database”.1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXPECTED_PRODUCTS_SORT limit MAX_DISPLAY_UPCOMING_PRODUCT' at line 9 in:
[select p.products_id, pd.products_name, products_date_available as date_expected from products p, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '1' and p.products_date_available >=20061107 and p.products_id = pd.products_id and p.products_status = 1 and pd.language_id = '1' order by EXPECTED_PRODUCTS_FIELD EXPECTED_PRODUCTS_SORT limit MAX_DISPLAY_UPCOMING_PRODUCTS]
catalog/includes/configure.php
catalog/admin/includes/configure.php
When set to “none” or “file” everything works fine.
I have tested this on a fresh install of Zen Cart v1.3.6
I suspect that there may be a problem with the “Execute” function in query_factory.php.
--- TO TEST ---
1. Install Zen Cart v1.3.6 using database cache
2. Unzip and copy the attached files to their corresponding directories
3. Configure "Country" and "Postcode" in Admin > Configuration > Shipping/Packaging
4. Install MyCourier in Admin > Modules > Shipping
5. Go to the catalog and browse to any products page and the above errors should occur
These errors can be removed by either:
1. Uninstalling MyCourier
2. Changing the SQL_CACHE_METHOD to "none" or "file"
3. Using fewer keys in the shipping module (In my testing less than about 230 keys and the errors disappear. But this seems to vary)
Bookmarks