From: [EMAIL PROTECTED]
Operating system: Linux 2.4 (RedHat 7.2)
PHP version: 4.1.1
PHP Bug Type: cURL related
Bug description: Curl and PHP_CURL_RETURN wrong behavior
Hi,
i still working with the PHP's curl functions (PHP 4.1.1) .
When call curl_exec() and CURLOPT_RETURNTRANSFER ist set (to 1) via
curl_opt() - php quit with a Segfault when curl_exec() receive nothink
from
the Server.
After i get the last CVS curl.c (V 1.105) the Segfault was fixed but php
return 1 (RETURN_TRUE) in such situation.
I have write a small (and perhaps dirty) hack witch will fix this.
Perhaps
the author of curl.c can update curl.c in the CVS to avoid the wrong
return
value
Thank u, PHP is great.
Hans-Juergen Petrich
/* curl.c */
/* {{{ proto bool curl_exec(int ch)
Perform a CURL session */
PHP_FUNCTION(curl_exec)
{
zval **zid;
php_curl *ch;
CURLcode error;
if (ZEND_NUM_ARGS() != 1 ||
zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
error = curl_easy_perform(ch->cp);
if (error != CURLE_OK) {
if (ch->handlers->write->buf.len > 0)
smart_str_free(&ch->handlers->write->buf);
SAVE_CURL_ERROR(ch, error);
RETURN_FALSE;
}
if (ch->handlers->write->method == PHP_CURL_RETURN) {
if (ch->handlers->write->buf.len <= 0)
RETURN_NULL();
if (ch->handlers->write->type != PHP_CURL_BINARY)
smart_str_0(&ch->handlers->write->buf);
RETURN_STRINGL(ch->handlers->write->buf.c,
ch->handlers->write->buf.len, 0);
}
RETURN_TRUE;
}
/* }}} */
--
Edit bug report at http://bugs.php.net/?id=15491&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=15491&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15491&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15491&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15491&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15491&r=support
Expected behavior: http://bugs.php.net/fix.php?id=15491&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15491&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=15491&r=submittedtwice