aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-10-23 12:33:28 -0700
committerGravatar Michael Lumish <mlumish@google.com>2015-10-23 12:33:28 -0700
commitdf5ac28b4072f4d85481dbc14b5c513521fd8d48 (patch)
treea1c475ea6736a84d30ca79dceb35032ece57c797
parent2f7b678c9fe1f65e598806e44534beb67daefb49 (diff)
parentd94f9260b89ff6168e48f2cce38c93169491366d (diff)
Merge pull request #3945 from stanley-cheung/php_remove_ssl_cert_var
PHP: remove ssl_cert_file env var
-rw-r--r--src/php/ext/grpc/credentials.c10
-rwxr-xr-xsrc/php/tests/interop/interop_client.php7
2 files changed, 8 insertions, 9 deletions
diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c
index 8e3b7ff212..e413070b45 100644
--- a/src/php/ext/grpc/credentials.c
+++ b/src/php/ext/grpc/credentials.c
@@ -111,21 +111,21 @@ PHP_METHOD(Credentials, createDefault) {
* @return Credentials The new SSL credentials object
*/
PHP_METHOD(Credentials, createSsl) {
- char *pem_root_certs;
+ char *pem_root_certs = NULL;
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
- int root_certs_length, private_key_length = 0, cert_chain_length = 0;
+ int root_certs_length = 0, private_key_length = 0, cert_chain_length = 0;
pem_key_cert_pair.private_key = pem_key_cert_pair.cert_chain = NULL;
- /* "s|s!s! == 1 string, 2 optional nullable strings */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!",
+ /* "|s!s!s! == 3 optional nullable strings */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!",
&pem_root_certs, &root_certs_length,
&pem_key_cert_pair.private_key, &private_key_length,
&pem_key_cert_pair.cert_chain,
&cert_chain_length) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException,
- "createSsl expects 1 to 3 strings", 1 TSRMLS_CC);
+ "createSsl expects 3 optional strings", 1 TSRMLS_CC);
return;
}
grpc_credentials *creds = grpc_ssl_credentials_create(
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index 5965097e18..03ce2ac700 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -391,12 +391,11 @@ $opts = [];
if ($use_tls) {
if ($use_test_ca) {
- $ssl_cert_file = dirname(__FILE__) . '/../data/ca.pem';
+ $ssl_credentials = Grpc\Credentials::createSsl(
+ file_get_contents(dirname(__FILE__) . '/../data/ca.pem'));
} else {
- $ssl_cert_file = getenv('SSL_CERT_FILE');
+ $ssl_credentials = Grpc\Credentials::createSsl();
}
- $ssl_credentials = Grpc\Credentials::createSsl(
- file_get_contents($ssl_cert_file));
$opts['credentials'] = $ssl_credentials;
$opts['grpc.ssl_target_name_override'] = $host_override;
}