paypal/ipn-code-samples — pull request #7 by wicketyjarjar (2013-10-11 14:00:11+00:00)
Title: Fix for VERIFIED/INVALID IPN response not working in debug mode

When outputted to the ipn.log file, the $res variable (before splitting with explode) is as follows:
```
HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Fri, 11 Oct 2013 04:39:54 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: (8 lines of Set-Cookie, shortened here for display purposes)
Vary: Accept-Encoding
Strict-Transport-Security: max-age=14400
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

VERIFIED
```

Line 98 is currently:

list($headers, $res) = explode("\r\n\r\n", $res, 2);

but because there are 2 "\r\n\r\n" line breaks in the output, it currently sets the $res variable equal to the second block of code, instead of the third block that contains the VERIFIED/INVALID response.

The proposed change:

list( , , $res) = explode("\r\n\r\n", $res);

resets the $res variable to contain just the IPN response code of VERIFIED or INVALID.

This alternative line:

list($http_status_code, $headers, $res) = explode("\r\n\r\n", $res);

could be used to better illustrate what is happening, but introduces 2 unnecessary variables.