diff options
author | Stanley Cheung <stanleycheung@google.com> | 2015-10-23 10:24:32 -0700 |
---|---|---|
committer | Stanley Cheung <stanleycheung@google.com> | 2015-10-23 10:24:32 -0700 |
commit | d94f9260b89ff6168e48f2cce38c93169491366d (patch) | |
tree | 4c2b955037a065ee5233d6b20124e34f5258e3d7 | |
parent | 97e399a38c683e53a8b102dd776a08f6ed9cb81a (diff) |
php: remove ssl_cert_file env var
-rw-r--r-- | src/php/ext/grpc/credentials.c | 10 | ||||
-rwxr-xr-x | src/php/tests/interop/interop_client.php | 7 |
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; } |