Skip to content

Commit cc9f16b

Browse files
committed
ext/curl: accept SensitiveParameterValue in curl_setopt
This makes it possible to pass things to curl_setopt without them leaking in backtraces.
1 parent 7b78eb4 commit cc9f16b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

ext/curl/interface.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,23 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
16251625
CURLcode error = CURLE_OK;
16261626
zend_long lval;
16271627

1628+
if (Z_TYPE_P(zvalue) == IS_OBJECT
1629+
&& instanceof_function(Z_OBJCE_P(zvalue), zend_ce_sensitive_parameter_value))
1630+
{
1631+
zval rv;
1632+
zval *inner_value;
1633+
1634+
inner_value = zend_read_property_ex(
1635+
zend_ce_sensitive_parameter_value,
1636+
Z_OBJ_P(zvalue),
1637+
ZSTR_KNOWN(ZEND_STR_VALUE),
1638+
0,
1639+
&rv
1640+
);
1641+
1642+
zvalue = inner_value;
1643+
}
1644+
16281645
switch (option) {
16291646
/* Callable options */
16301647
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_WRITE, write, PHP_CURL_STDOUT);

0 commit comments

Comments
 (0)