Forums / Bug Reports / [Done v1.3.8] Database Cache Bug

[Done v1.3.8] Database Cache Bug

Locked
Results 1 to 9 of 9
This thread is locked. New replies are disabled.
07 Nov 2006, 12:56
#1
ben avatar

ben

New Zenner

Join Date:
Aug 2006
Posts:
30
Plugin Contributions:
0

[Done v1.3.8] Database Cache Bug

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 114


Warning: 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 102



Warning: 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 78


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]


These errors are only returned when the SQL_CACHE_METHOD in the following files are set to “database”.
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)
07 Nov 2006, 14:54
#2
kim avatar

kim

Obaa-san

Join Date:
Jun 2003
Posts:
26,564
Plugin Contributions:
0

Re: [Done v1.3.8] Database Cache Bug

What version of php are you using?
07 Nov 2006, 15:43
#3
jeffd avatar

jeffd

Totally Zenned

Join Date:
Sep 2004
Posts:
605
Plugin Contributions:
1

Re: [Done v1.3.8] Database Cache Bug

Just a comment regarding this error...

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 114


We are using the 'file' method, yet every one in a while (maybe once a week) we get an errorlog write such as the above. I have never been able to track down where this comes from and not certain it is related to your problem but thought I should mention it.

We are using Windows 2000, MySQL 5.0.21, Apache/2.2.2 (Win32) mod_ssl/2.2.2 OpenSSL/0.9.8b mod_jk/1.2.15 PHP/5.1.4

Jeff
07 Nov 2006, 22:01
#4
ben avatar

ben

New Zenner

Join Date:
Aug 2006
Posts:
30
Plugin Contributions:
0

Re: [Done v1.3.8] Database Cache Bug

PHP Version: 4.4.2 (Zend: 1.3.0)
MySQL 5.0.24-standard
Server OS: Linux 2.6.9-42.0.3.ELsmp
08 Nov 2006, 10:34
#5
ben avatar

ben

New Zenner

Join Date:
Aug 2006
Posts:
30
Plugin Contributions:
0

Re: [Done v1.3.8] Database Cache Bug

Hi JeffD, thanks for your comments.

I'm not familiar with the "errorlog" you mentioned. Are you referring to the one in cPanel or does Zen Cart have its own error log?
08 Nov 2006, 10:52
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: [Done v1.3.8] Database Cache Bug

As of v1.3.x, Zen Cart does not manage an errorlog.
The reference is most likely to the Apache errorlog (which, yes, is accessible via cPanel on cPanel-equipped hosts).
08 Nov 2006, 14:24
#7
jeffd avatar

jeffd

Totally Zenned

Join Date:
Sep 2004
Posts:
605
Plugin Contributions:
1

Re: [Done v1.3.8] Database Cache Bug

Actually the errorlog I was referencing was the PHP errors log which can be enabled by setting the path and name of the file in the php.ini file, and then enabling the flag.

Jeff
04 Dec 2006, 08:46
#8
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: [Done v1.3.8] Database Cache Bug

I salute you for this bug contribution. I have used database session cacheing for all my shops till I upgrade to 1.36 and heck, I was at deadend with these strange errors. Changed to file cacheing and all the problem's gone. The error is exactly the same. I dont know what is happening behind nor can I trouble shoot, but your bug report definitely solved my problem