New Zenner
- Join Date:
- Feb 2005
- Location:
- Syracuse, New York, USA
- Posts:
- 39
- Plugin Contributions:
- 0
Post #1 by decartwr
After upgrading to PHP 5.3.1 and installing the recommended 5.3 patches (on a 1.3.8a ZC), I am getting an error "explode() expects parameter 2 to be string" in function "zen_get_prid" in functions/functions_general.php.
This happens when I go into my shopping cart and change the quantity on an item and click "update".
The offending line of code is:
$pieces = explode(':', $uprid);
The problem is that $uprid is an array, not a string. $uprid is a parameter to the function, which is being called from the "in_cart_mixed" function in classes/shopping_cart, which in turn is called from function "actionUpdateProduct" in classes/shopping_cart.
Inspecting the code, the source of the array is $_POST['products_id']. I haven't worked back any farther than this.
I applied the following work-around:
Just before the above-shown line of code, I added:
if ( is_array( $uprid ) && (count( $uprid ) === 1) )
$uprid = $uprid[ 0 ];
This has the effect of liberating the string from within the array. This works because $uprid in fact contains a single string, it's just stuffed inside an array. So I check for that precise case, and liberate the string from within the array.
This eliminates the error and seems to function correctly, but I consider this a very temporary work-around. The right solution surely lies in the functions that call "zen_get_prid".