Change in CURLOPT_NOBODY option
Be careful when upgrading PHP, if you’re using cURL. Somewhere between PHP 5.2.6 and 5.2.9, the definition of the CURLOPT_NOBODY option was changed. After upgrading (under duress — but that’s a different story…), all my ecommerce scripts that handled posting customer data to our processing company were completely fuxored. My main ecommerce site was on it’s proverbial ass, and for no apparent reason.
As it turns out, the cURL developers decided to change CURLOPT_NOBODY and make it reset the request type of the cURL object to a HEAD request. In my case my processor expects a POST, with the data for the transaction in the body of the request. Changing my requests to HEAD obviously caused a problem and it was pretty difficult to find the culprit.
Don’t ask me why I was using CURLOPT_NOBODY. It was part of some example code that I copied when first experimenting with cURL a long time ago. It worked, at the time, and that’s all I was concerned about. Anyway, after much hand-wringing and gnashing of teeth, I finally figured it out and removed the offending option. I just wish they would announce changes like this a little more broadly. Making subtle changes behind the curtain that break existing code is not good programming practice — especially for a library as popular as cURL.
Filed in PHP, Technology No Responses yet