Skip to content

Bug 63271 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,7 @@ PHP_FUNCTION(curl_copy_handle)
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
CURLcode error=CURLE_OK;
long opt_val_long = 0;

switch (option) {
/* Long options */
Expand Down Expand Up @@ -2049,6 +2050,9 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_RESUME_FROM:
case CURLOPT_SSLVERSION:
case CURLOPT_SSL_VERIFYHOST:
if(Z_TYPE_PP(zvalue)==IS_BOOL && Z_BVAL_PP(zvalue)) {
opt_val_long = 2L;
}
case CURLOPT_SSL_VERIFYPEER:
case CURLOPT_TIMECONDITION:
case CURLOPT_TIMEOUT:
Expand Down Expand Up @@ -2149,7 +2153,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#if CURLOPT_MUTE != 0
case CURLOPT_MUTE:
#endif
convert_to_long_ex(zvalue);
if(!opt_val_long) {
convert_to_long_ex(zvalue);
opt_val_long = Z_LVAL_PP(zvalue);
}
#if LIBCURL_VERSION_NUM >= 0x71304
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
(PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) {
Expand All @@ -2158,7 +2165,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
return 1;
}
#endif
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, opt_val_long);
break;

/* String options */
Expand Down
3 changes: 3 additions & 0 deletions ext/soap/php_soap.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,7 @@ zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *faul
#define soap_error3(severity, format, param1, param2, param3) \
php_error(severity, "SOAP-ERROR: " format, param1, param2, param3)

#define SOAP_CACHE_ENABLED() \
SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0

#endif
42 changes: 4 additions & 38 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,48 +463,14 @@ zend_module_entry soap_module_entry = {
ZEND_GET_MODULE(soap)
#endif

ZEND_INI_MH(OnUpdateCacheEnabled)
{
if (OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
return FAILURE;
}
if (SOAP_GLOBAL(cache_enabled)) {
SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
} else {
SOAP_GLOBAL(cache) = 0;
}
return SUCCESS;
}

ZEND_INI_MH(OnUpdateCacheMode)
{
char *p;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
char *base = (char *) ts_resource(*((int *) mh_arg2));
#endif

p = (char*) (base+(size_t) mh_arg1);

*p = (char)atoi(new_value);

if (SOAP_GLOBAL(cache_enabled)) {
SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
} else {
SOAP_GLOBAL(cache) = 0;
}
return SUCCESS;
}

PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateCacheEnabled,
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateLong,
cache_enabled, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateString,
cache_dir, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl", "86400", PHP_INI_ALL, OnUpdateLong,
cache_ttl, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache", "1", PHP_INI_ALL, OnUpdateCacheMode,
STD_PHP_INI_ENTRY("soap.wsdl_cache", "1", PHP_INI_ALL, OnUpdateLong,
cache_mode, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_limit", "5", PHP_INI_ALL, OnUpdateLong,
cache_limit, zend_soap_globals, soap_globals)
Expand Down Expand Up @@ -1102,7 +1068,7 @@ PHP_METHOD(SoapServer, SoapServer)
memset(service, 0, sizeof(soapService));
service->send_errors = 1;

cache_wsdl = SOAP_GLOBAL(cache);
cache_wsdl = SOAP_CACHE_ENABLED();

if (options != NULL) {
HashTable *ht = Z_ARRVAL_P(options);
Expand Down Expand Up @@ -2318,7 +2284,7 @@ PHP_METHOD(SoapClient, SoapClient)
php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null");
}

cache_wsdl = SOAP_GLOBAL(cache);
cache_wsdl = SOAP_CACHE_ENABLED();

if (options != NULL) {
HashTable *ht = Z_ARRVAL_P(options);
Expand Down