Deprecated error with Lemonstand V1 and Braintree Payments

If you’re running an eCommerce website using Lemonstand V1 (which is now unsupported since their V2 is the new hot stuff) and have recently upgraded your server to PHP 5.5+, you may run into a deprecated error when using Braintree Payments.

The error is in /modules/shop/payment_types/shop_braintree_transpredirect_payment/Braintree/Util.php and is pretty easy to fix.

There are two functions using the deprecated /e modifier: delimiterToCamelCase & camelCaseToDelimiter.

The fixed versions of these methods are:

delimiterToCamelCase

public static function delimiterToCamelCase($string, $delimiter = '[\-\_]')
{
    return preg_replace_callback('/' . $delimiter . '(\w)/',function($matches)   {
        return strtoupper($matches[1]);
    },$string);
}

camelCaseToDelimiter

public static function camelCaseToDelimiter($string, $delimiter = '-')
{
     return preg_replace_callback('/([A-Z])/',function($matches) use ($delimiter)  {
        return $delimiter.strtolower($matches[1]);
    },$string);
}

One comment on “Deprecated error with Lemonstand V1 and Braintree Payments

  1. Brad

    This is probably a stretch but I have 2 Lemonstand V1 stores using Braintree payments that just stopped processing payments. I don’t think Lemonstand will help anymore, just wondering if you might have run in to the same issue? Could you email me?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *