Error During Checkout

Just moved a site from one host to another.



When checking out, we get the following error during checkout:

[indent=1]Undefined offset: 1 in [/indent]

[indent=1]/app/Tygh/Http.php on line 227[/indent]



The line of code in question is

[indent=1]list(self::$_headers, $content) = preg_split(“/\R\R/”, $content, 2);[/indent]



The site uses Authorize.Net.



What I found is that we do in fact get a valid response back from Authorize.Net (in the form of $content). The function is suppose to split the content into a header and content portion, based on 2 consecutive new lines. I do not know why, but the split is not working, but I suspect this is a symptom of some other problem.



I was able to get the following line o f code to work on a test response

[indent=1]list(self::$_headers, $content) = explode(“\n\n”, $content);[/indent]

, but it still fails during a live test.



Everything worked great until we moved the site.



The new provider is running on Parallels (if that matters?).



Any ideas?

We were able to resolve this with the help of CS Cart technical support



[indent=1][color=#555555]For some reason the [/color]preg_split[color=#555555] function does not work properly on your server. There are no such well known bugs in standard CS-Cart. Unfortunately, I cannot tell you exactly what server settings are causing this. Anyway, in order to fix the issue, I replaced the code of the [/color]_parseContent[color=#555555] function with this one:[/color][/indent]

while (strpos(ltrim($content), 'HTTP/1') === 0) {

list(self::$_headers, $content) = preg_split(“/(\r?\n){2}/”, $content, 2);

}

[indent=1][color=#555555]Now the issue is resolved, there is no error during checkout, the order has a correct status (I used a test credit card data) and response is correctly returned (please have a look at the screen shots attached). Please check it.[/color][/indent]



Hopefully this helps someone that may have a similar issue.

Are you running a windows server? I believe the HTTP standard calls for 2 newline characters (“\n\n”) but a windoz server might be using “\r\n\r\n”. But I don't think any server would use the simple return pair of “\r\r”.

[quote name='tbirnseth' timestamp='1405974550' post='187947']

Are you running a windows server? I believe the HTTP standard calls for 2 newline characters (“\n\n”) but a windoz server might be using “\r\n\r\n”. But I don't think any server would use the simple return pair of “\r\r”.

[/quote]



No, it is a Linux server running Parallels in a shared hosting environment.