mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
This commit is contained in:
parent
8cce5b2641
commit
4a2e40bb86
169 changed files with 3285 additions and 3175 deletions
|
@ -2243,7 +2243,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
#endif
|
||||
{
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
int ret = php_curl_option_str(ch, option, str->val, str->len, 0);
|
||||
int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2268,7 +2268,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
error = curl_easy_setopt(ch->cp, option, NULL);
|
||||
} else {
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
int ret = php_curl_option_str(ch, option, str->val, str->len, 0);
|
||||
int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2279,7 +2279,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
case CURLOPT_PRIVATE:
|
||||
{
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
int ret = php_curl_option_str(ch, option, str->val, str->len, 1);
|
||||
int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 1);
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2288,7 +2288,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
case CURLOPT_URL:
|
||||
{
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
int ret = php_curl_option_url(ch, str->val, str->len);
|
||||
int ret = php_curl_option_url(ch, ZSTR_VAL(str), ZSTR_LEN(str));
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2448,7 +2448,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
|
||||
ZEND_HASH_FOREACH_VAL(ph, current) {
|
||||
val = zval_get_string(current);
|
||||
slist = curl_slist_append(slist, val->val);
|
||||
slist = curl_slist_append(slist, ZSTR_VAL(val));
|
||||
zend_string_release(val);
|
||||
if (!slist) {
|
||||
php_error_docref(NULL, E_WARNING, "Could not build curl_slist");
|
||||
|
@ -2522,11 +2522,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
|
||||
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
|
||||
if (Z_TYPE_P(prop) != IS_STRING) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", string_key->val);
|
||||
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
|
||||
} else {
|
||||
postval = Z_STR_P(prop);
|
||||
|
||||
if (php_check_open_basedir(postval->val)) {
|
||||
if (php_check_open_basedir(ZSTR_VAL(postval))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2539,11 +2539,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
filename = Z_STRVAL_P(prop);
|
||||
}
|
||||
form_error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key->val,
|
||||
CURLFORM_NAMELENGTH, string_key->len,
|
||||
CURLFORM_FILENAME, filename ? filename : postval->val,
|
||||
CURLFORM_COPYNAME, ZSTR_VAL(string_key),
|
||||
CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
|
||||
CURLFORM_FILENAME, filename ? filename : ZSTR_VAL(postval),
|
||||
CURLFORM_CONTENTTYPE, type ? type : "application/octet-stream",
|
||||
CURLFORM_FILE, postval->val,
|
||||
CURLFORM_FILE, ZSTR_VAL(postval),
|
||||
CURLFORM_END);
|
||||
if (form_error != CURL_FORMADD_OK) {
|
||||
/* Not nice to convert between enums but we only have place for one error type */
|
||||
|
@ -2561,10 +2561,10 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
* must be explicitly cast to long in curl_formadd
|
||||
* use since curl needs a long not an int. */
|
||||
form_error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key->val,
|
||||
CURLFORM_NAMELENGTH, string_key->len,
|
||||
CURLFORM_COPYCONTENTS, postval->val,
|
||||
CURLFORM_CONTENTSLENGTH, postval->len,
|
||||
CURLFORM_COPYNAME, ZSTR_VAL(string_key),
|
||||
CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
|
||||
CURLFORM_COPYCONTENTS, ZSTR_VAL(postval),
|
||||
CURLFORM_CONTENTSLENGTH, ZSTR_LEN(postval),
|
||||
CURLFORM_END);
|
||||
|
||||
if (form_error != CURL_FORMADD_OK) {
|
||||
|
@ -2589,18 +2589,18 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
#if LIBCURL_VERSION_NUM >= 0x071101
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, str->len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, str->val);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str));
|
||||
zend_string_release(str);
|
||||
#else
|
||||
char *post = NULL;
|
||||
zend_string *str = zval_get_string(zvalue);
|
||||
|
||||
post = estrndup(str->val, str->len);
|
||||
post = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
|
||||
zend_llist_add_element(&ch->to_free->str, &post);
|
||||
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, str->len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
|
||||
zend_string_release(str);
|
||||
#endif
|
||||
}
|
||||
|
@ -2695,12 +2695,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
|||
zend_string *str = zval_get_string(zvalue);
|
||||
int ret;
|
||||
|
||||
if (str->len && php_check_open_basedir(str->val)) {
|
||||
if (ZSTR_LEN(str) && php_check_open_basedir(ZSTR_VAL(str))) {
|
||||
zend_string_release(str);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ret = php_curl_option_str(ch, option, str->val, str->len, 0);
|
||||
ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue