mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
fix curl_init()
"s" in HEAD accepts zstr
This commit is contained in:
parent
5389a44a05
commit
f5d82e28ce
1 changed files with 9 additions and 9 deletions
|
@ -1089,17 +1089,17 @@ PHP_FUNCTION(curl_init)
|
||||||
{
|
{
|
||||||
php_curl *ch;
|
php_curl *ch;
|
||||||
CURL *cp;
|
CURL *cp;
|
||||||
char *src = NULL;
|
zstr src = NULL_ZSTR;
|
||||||
int src_len;
|
int src_len;
|
||||||
zend_uchar src_type;
|
zend_uchar src_type;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|t", &src, &src_len, &src_type) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|t", &src, &src_len, &src_type) == FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src && src_type == IS_UNICODE) {
|
if (src.v && src_type == IS_UNICODE) {
|
||||||
src = zend_unicode_to_ascii((UChar*)src, src_len TSRMLS_CC);
|
src.s = zend_unicode_to_ascii((UChar*)src.u, src_len TSRMLS_CC);
|
||||||
if (!src) {
|
if (!src.s) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1139,10 +1139,10 @@ PHP_FUNCTION(curl_init)
|
||||||
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
|
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (src) {
|
if (src.v) {
|
||||||
char *urlcopy;
|
char *urlcopy;
|
||||||
|
|
||||||
urlcopy = estrndup(src, src_len);
|
urlcopy = estrndup(src.s, src_len);
|
||||||
curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
|
curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
|
||||||
zend_llist_add_element(&ch->to_free.str, &urlcopy);
|
zend_llist_add_element(&ch->to_free.str, &urlcopy);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue