AbanteCart Community
Shopping Cart Operations => Support => General Support => Topic started by: digitalt on September 23, 2016, 11:59:02 AM
-
This is showing up in error log:
2016-09-23 11:28:41 - warning: AbanteCart core v.1.2.8 Illegal string offset 'start' in <b>/home/digitalt2016/public_html/cbto.us/storefront/model/catalog/manufacturer.php</b> on line <b>66</b>
Also on line 80.
Did some research and it appears that a string is being called as an array. Not a big deal from what I have read, but it could slow down overall performance. For newbie ecommerce sites, response is of the utmost importance. Ya'all got a simple fix?
Here's the code for that section:
$cache_key = 'manufacturer.list.'.md5((int)$data['start'].(int)$data['limit']).'.store_'.$store_id;
$output = $this->cache->pull( $cache_key );
if ($output !== false){
return $output;
}
$sql = "SELECT *
FROM " . $this->db->table("manufacturers") . " m
LEFT JOIN " . $this->db->table("manufacturers_to_stores") . " m2s
ON (m.manufacturer_id = m2s.manufacturer_id)
WHERE m2s.store_id = '" . $store_id . "'
ORDER BY sort_order, LCASE(m.name) ASC";
if ($data['limit']){
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}
$query = $this->db->query($sql);
$output = $query->rows;
$this->cache->push($cache_key, $output);
return $output;
}
Appears to be the $cache_key string.
-
Hello.
What page you visit when error occur?
-
I'm not sure. It seems intermittent. This is only in A-cart error log and not the server error log.
If I remember correctly, this started showing up after I cloned the default theme into an extension. The only mods I did to the theme were in the style.css and custom.js.
Let me do some checking and I'll get back to you. There were a lot of errors yesterday and I was working on shipping methods. Maybe connected to that? I'll see if I can recreate the error to a specific page or package.
-
Try this fix
https://github.com/abantecart/abantecart-src/commit/973c0d7bef5ec5b9b2ce1cb6a477e24278653c45
It should fix the warning.
-
That's what's there. Oops, using 1.2.8.
It doesn't cause any real performance issues on Godaddy for me. But wanted to make you aware of it.
Took a closer look today and applied the new code. So far so good.
-
So far the mod works great.
Thanks
-
I've been ignoring this, but also have been getting this error:
2016-10-23 6:43:11 - warning: AbanteCart core v.1.2.8 Illegal string offset 'limit' in <b>/home/digitalt2016/public_html/cbto.us/storefront/model/catalog/manufacturer.php</b> on line <b>83</b>
This is the code starting at line 83:
if ($data['limit']){
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}
$query = $this->db->query($sql);
$output = $query->rows;
$this->cache->push($cache_key, $output);
return $output;
}
I'm guessing the fix is similar to what was already done, but not sure how to do it.
-
I wonder how this happen. Do you have some custom code/extension that calls getManufacturers method with limit passed?
Limit parameter is forced to 0 if negative and converted to int.
-
The only extension I added was Whitelabel and cloned the default template as a new extension. The cloned template only has changes in the .css files and custom.js(no code modifications, only removed some things for a cleaner mobile screen). Other than that it's a clean installation.
Strange thing is, the error seems random. If it was serious, there should be an error every time manufacturer.php is called.
I just spent 15 minutes trying to recreate the error to pinpoint it and no luck. Is there some code I could add to manufacturer.php to log more detail about this? It's not creating a problem with the site, just a little annoying.
-
Check your Apache log. It it possible that someone is paying with pagination parameters and that will cause this error.
It will not destroy anything. Possibly we can add better error handling in here.
-
Thanks, I'll check it.
-
hi i am having problem in putting store logo, if i click edit on default template comes blank fields without AbanteCart store logo and icon so there will be no where to click to change the logo , how do i correct the problem.
-
Just a thought, but could this error be coming from the manufacturers data cache? I have had problems with errors that didn't resolve till I cleared the caches and then everything was okay.
Is there a way to disable manufacturers data cache to test ?