curl_read, can return -1 when it explicitly states its return size_t. This causes curl versions >= 7.18.X to fail with the attached code.
Curl stores the callback return value as int, but casts it to a size_t to do a check. This causes the value to become very large and thus the check fails when it should not.
I tried to download a snapshot and check that out, but the site appears to be down.
I have a similar code using cURL that worked fine in two platforms, but failed on other two.
As you can see, the libcurl 7.18.x may really have a bug/error/problem.
I think there was a change in the option CURLOPT_POST. Now, to use this option, it seems to be necessary to set the option CURLOPT_POSTFIELDS (curl_setopt($ch, CURLOPT_POSTFIELDS, "");).
Yes, if you set POSTFIELDS to "", then curl_read does not return -1. The root of the problem is that the default return value is -1, when it should be 0 as it returns a size_t which is an unsigned type.
A check was added in libcurl 7.18 where the value is cast to size_t and compared. This is the ``effect'' of the problem, but the cause is that the php supplied curl_read callback is returning -1.
Looks like php 4.4.9 is still broken. I know its not supported anymore, but people are going to be using it for quite some time so I'd think it might be prudent to fix it....given that its so simple.
PHP 4 is dead and no fixes, even the simplest, will be applied to it.