aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib
diff options
context:
space:
mode:
authorGravatar Brent Shaffer <betterbrent@google.com>2018-07-19 16:52:46 -0700
committerGravatar Brent Shaffer <betterbrent@google.com>2018-07-19 16:52:46 -0700
commitad371f802d35686ad6776cc01d1287275f6dd9d6 (patch)
tree5d62cb73ddeb99d020c16f1f897816c3fead83f1 /src/php/lib
parentb75910369729bd0349865d0e3335f2c0f4bca1c1 (diff)
fixes subpackage issue with loading composer
Diffstat (limited to 'src/php/lib')
-rw-r--r--src/php/lib/Grpc/BaseStub.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index ecb419ac8f..fe81e37761 100644
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -83,10 +83,11 @@ class BaseStub
}
private static function updateOpts($opts) {
- $package_config = json_decode(
- file_get_contents(dirname(__FILE__).'/../../composer.json'),
- true
- );
+ if (!file_exists($composerFile = __DIR__.'/../../composer.json')) {
+ // for grpc/grpc-php subpackage
+ $composerFile = __DIR__.'/../composer.json';
+ }
+ $package_config = json_decode(file_get_contents($composerFile), true);
if (!empty($opts['grpc.primary_user_agent'])) {
$opts['grpc.primary_user_agent'] .= ' ';
} else {