• Posted by teknologika 9 months ago.
  • There are 17 posts. The latest reply is from christopher
  • not resolved
  • WordPress version: Not Supplied
  • WP e-Commerce version: Not Supplied

No tags yet.

The free community support forum is a place where WP e-Commerce users can work with other WP e-Commerce users to help one another get their shops up and running. There is no gaurantee that an Instinct staff member will respond to your topic within the free forum.

Acting out, swearing and threats are not tolerated, please play nice, we are all doing the best we can with the resources available.

 

  1. teknologika
    New Member

    Warning: stripslashes() expects parameter 1 to be string, array given in /Library/WebServer/Documents/wp-content/plugins/wp-e-commerce/wpsc-includes/checkout.class.php on line 348

    Versions:

    wp - e 3.7.5
    wp - 2.8.6
    php 5.3.0 running on mac os x snow lepoard

    Steps to repo: Setup a test install and try to checkout with the manual / test gateway. The check out can't save with the following error in the country drop down:

    Warning: stripslashes() expects parameter 1 to be string, array given in /Library/WebServer/Documents/wp-content/plugins/wp-e-commerce/wpsc-includes/checkout.class.php on line 348

    Posted 9 months ago #

  2. fenrir
    New Member

    Yep this problem is killing me as well. At first i thought it was MU related, so i installed a fresh copy of standard Wordpress 2.8.6, and then wp-e-commerce 3.75 all running on PHP 5.3.0 on windows 2003 server, and same exact error again on line 348! Ugh i have no idea why this is falling over, and i can only assume it has something to do with the PHP 5.3.0 setup?

    Does anyone have any ideas how i can get past this, as it doesn't matter whether i use manual payment or Paypal it always throws this error.

    Cheers
    Phil

    Posted 9 months ago #

  3. fenrir
    New Member

    Ok updated my PHP to 5.3.1 in the hope it may fix this issue but still having the same problem??

    PHP 5.3.1 running on Windows 2003 Server / IIS6, under FastCGI
    WP-Ecommerce 3.7.5
    WordPress - 2.8.6

    Error:
    "PHP Warning: stripslashes() expects parameter 1 to be string, array given in C:\Webs\WordPress\activewatersports.com.au\wwwroot\wp-content\plugins\wp-e-commerce\wpsc-includes\checkout.class.php on line 348
    PHP Warning: stripslashes() expects parameter 1 to be string, array given in C:\Webs\WordPress\activewatersports.com.au\wwwroot\wp-content\plugins\wp-e-commerce\wpsc-includes\checkout.class.php on line 348"

    I cannot get past the checkout because of this regardless of payment type.

    Any help would be greatly appreciated.

    Cheers
    Phil

    Posted 9 months ago #

  4. marcel
    New Member

    I get the same error...

    Posted 8 months ago #

  5. danielrouse
    New Member

    I'm also getting this error on the checkout page and "Your Details" page. PHP 5.3.1, WP e-commmerce 3.7.5.3

    Posted 8 months ago #

  6. fenrir
    New Member

    Guys if you want to get past this error and proceed through the checkout process you can just comment out the following line in the checkout.class.php file:

    Line 348:
    //$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this>checkout_item->id]), ENT_QUOTES);

    The negative is that you won't get form state preserved if they submit the checkout form with fields that don't pass validation, however with my limited PHP knowledge of session/form handling i don't know why this error is occurring in the first place so this is my temporary solution.

    Cheers
    Phil

    Posted 8 months ago #

  7. chris.heney
    New Member

    You may want to add conditional if (is_array())

    Posted 8 months ago #

  8. fenrir
    New Member

    Hi Chris. Sorry i'm not really familiar with PHP syntax or structures, how would i go about applying the array check to the form fields array in this case?

    I am assuming that $_SESSION['wpsc_checkout_saved_values'] is always an array, so the values inside the array positions must not be strings as expected though i have no idea why.

    So i was guessing the check would be if (is_array($_SESSION['wpsc_checkout_saved_values'][$this>checkout_item->id]))?

    Cheers
    Phil

    Posted 7 months ago #

  9. karenalma
    New Member

    Just in case anyone is wondering, I tried fenrir's is_array and it works.

    Posted 5 months ago #

  10. goddess
    New Member

    Thank you for this! Was running into the same problem.

    For simplicity, the full line to replace is this:

    //$saved_form_data = htmlentities(stripslashesif (is_array($_SESSION['wpsc_checkout_saved_values'][$this>checkout_item->id])), ENT_QUOTES, 'UTF-8');

    It's on line 413 in 3.76RC1, or you can find the exact line in other versions if you add the error display line to your .htaccess file, php_value display_errors on

    Posted 5 months ago #

  11. totenmaus
    New Member

    The problem is that $_SESSION['wpsc_checkout_saved_values'] is a multidimensional array. The entries that store Country and State are a sub-array, so the stripslashes command gakks out because it's not processing a simple string.

    I replaced line 348 with this:

    if (!is_array($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id])) {
    	$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES);
    		}

    Basically just encapsulating the problem line with a conditional to evaluate if the content of the main array is a string or a sub-array. It's not as elegant as it could be: the best solution would be to extract the sub-array contents as strings, but I reached the end of my php knowledge.

    Posted 5 months ago #

  12. karan
    New Member

    Hello,
    please open your ajax.functions.php file .
    The path for this file is wp-e-commerce/wpsc-includes/ajax.functions.php
    Now search $_SESSION['wpsc_previous_selected_gateway'] in this file and add
    following line just below the session variable
    $is_valid = true;

    Now your whole if state ment should be like this

    if(array_search($submitted_gateway,$selected_gateways) !== false) {
    		$_SESSION['wpsc_previous_selected_gateway'] = $submitted_gateway;
    		$is_valid = true;
    		} else {
    		$is_valid = false;
      }

    This thing worked for me and hope it will work for you as well

    Thanks

    Posted 4 months ago #

  13. orson4music
    New Member

    Here is my solution.

    if (!is_array($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id])) {
    			$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES);
    		} else {
    			$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id][0]), ENT_QUOTES);
    		}
    Posted 4 months ago #
  14. I just solved the problem by reverting back from PHP 5.3.0 to 5.2.13.

    Posted 4 months ago #

  15. udnis
    New Member

    So....This plugin (wp-e-commerce 3.75) works perfectly in PHP 5.2.x. Coz by reverting back my PHP 5.3.0 to 5.2.13, the plugin works without this error appear

    Posted 2 months ago #
  16. Trusted
    leewillis77
    Resident Expert

    @udnis

    This "error" only causes a significant problem if you have PHP error reporting turned on. It's likely you had it on with 5.3.0, but not with 5.2.13. Just turn it off and this issue will stop causing you a headache ...

    Posted 2 months ago #

  17. christopher
    New Member

    @leewillis77 we are settting up a new customer and are experiencing this as well. Running the latest versions of everying, including PHP 5.3.0. Is this still the recommended solution, and will there be any code changes with 3.8 to resolve? Thank you

    Posted 3 weeks ago #

RSS feed for this topic

Reply

You must log in to post.