Hello!
I have those errors with the uc_attribute module, in logs
[error] [client 195.225.231.201] PHP Warning: Illegal string offset 'attributes' in /var/www/sites/all/modules/ubercart/uc_attribute/uc_attribute.module on line 1293,
[error] [client 195.225.231.201] PHP Notice: Array to string conversion in /var/www/sites/all/modules/ubercart/uc_attribute/uc_attribute.module on line 1293,
[error] [client 195.225.231.201] PHP Notice: unserialize(): Error at offset 0 of 189 bytes in /var/www/sites/all/modules/ubercart/uc_product/uc_product.module on line 614
I have find out that ubercart tried to set array items on a string,
here the code
uc_attribute.module:1293
if (!empty($values)) {
$data = $product->data; // <---- $product->data on some conditions is a string
$data['attributes'] = $values;
if (isset($product->qty)) {
// Preserve the quantity (for product-kit sub-products).
$qty = $product->qty;
}
$data variable - some times exist as arrays and some time as string!
so I did check, same as in _uc_product_get_variant function
// Ensure that $data is an array (user module leaves it serialized).
if (isset($data) && !is_array($data)) {
$data = unserialize($data);
}
after this fix error is gone
Comments
Comment #2
longwaveDuplicate of #2041977: Warnings and Notices when using Add to Cart form in a View.
The project maintainers have been unable to reproduce this issue. If you can track down exactly when $product->data is a string or why this happens, your help would be very much appreciated.