diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6f089303b..e2c1d8afa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,10 @@ #Change Log All notable changes to this project starting with the 0.6.0 release will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org) +##[0.7.1] - 2015-08-21 +###Fixed +- PHP 5.3 incompatibility + ##[0.7.0] - 2015-08-20 ### Added - `site delete` command will delete a site (moved from `sites delete`, which has been deprecated) (#370) diff --git a/php/Terminus/Endpoint.php b/php/Terminus/Endpoint.php index 1ec7e7081..cfc5091c2 100755 --- a/php/Terminus/Endpoint.php +++ b/php/Terminus/Endpoint.php @@ -50,33 +50,32 @@ public function __construct() * ); * */ - private function lookup( $args ) - { + private function lookup($args) { // adjust the target if it's a public request - if ( isset($args['uuid']) AND 'public' === $args['uuid'] ) { + if (isset($args['uuid']) && ($args['uuid'] == 'public')) { $this->target = 'public'; } - if ('login' == $args['realm']) { + if (isset($args['realm']) && ($args['realm'] == 'login')) { $this->target = 'login'; } - $args['host'] = @$args['host'] ?: TERMINUS_HOST; + if (!isset($args['host']) || ($args['host'] == '')) { + $args['host'] = TERMINUS_HOST; + } - // a substiution array to pass to the vsprintf - $substitutions = array( $args['host'], $args['realm'] ); - if( isset($args['uuid']) AND $args['uuid'] !== 'public' ) { - array_push( $substitutions, $args['uuid'] ); + //A substiution array to pass to the vsprintf + $substitutions = array($args['host'], $args['realm']); + if (isset($args['uuid']) && $args['uuid'] != 'public') { + array_push($substitutions, $args['uuid']); } - $url = vsprintf( $this->patterns[$this->target], $substitutions ); + $url = vsprintf($this->patterns[$this->target], $substitutions); - // now we have our base url add the path - $params = ''; - if (@$args['path']) { - $params .= '/' . @$args['path']; + //Now that we have our base url, we add the path + if (isset($args['path']) && $args['path']) { + $url .= '/' . $args['path']; } - $url .= $params; return $url; } diff --git a/php/Terminus/Environment.php b/php/Terminus/Environment.php index f9321b885..395299543 100755 --- a/php/Terminus/Environment.php +++ b/php/Terminus/Environment.php @@ -225,8 +225,9 @@ public function connectionInfo() { $info = array_merge($info, $git_params); - if (isset($this->bindings->getByType('dbserver')[0])) { - $db_binding = $this->bindings->getByType('dbserver')[0]; + $dbserver_binding = $this->bindings->getByType('dbserver'); + if (isset($dbserver_binding[0])) { + $db_binding = $dbserver_binding[0]; $mysql_username = 'pantheon'; $mysql_password = $db_binding->get('password'); @@ -266,8 +267,9 @@ public function connectionInfo() { $info = array_merge($info, $mysql_params); } - if (isset($this->bindings->getByType('cacheserver')[0])) { - $cache_binding = $this->bindings->getByType('cacheserver')[0]; + $cacheserver_binding = $this->bindings->getByType('cacheserver'); + if (isset($cacheserver_binding[0])) { + $cache_binding = $cacheserver_binding[0]; $redis_password = $cache_binding->get('password'); $redis_host = $mysql_host = sprintf( diff --git a/php/Terminus/Request.php b/php/Terminus/Request.php index b7e3dd347..4a700b328 100755 --- a/php/Terminus/Request.php +++ b/php/Terminus/Request.php @@ -23,16 +23,23 @@ public static function send($url, $method, $data = array()) { // create a new Guzzle\Http\Client $browser = new Browser; $browser->setUserAgent(self::userAgent()); - $options = array(); - $options['allow_redirects'] = @$data['allow_redirects'] ?: false; - $options['json'] = @$data['json'] ?: false; - if( @$data['body'] ) { + $options = array( + 'allow_redirects' => false, + 'verify' => false, + 'json' => false + ); + if (isset($data['allow_redirects'])) { + $options['allow_redirects'] = $data['allow_redirects']; + } + if (isset($data['json'])) { + $options['json'] = $data['json']; + } + if (isset($data['body']) && $data['body']) { $options['body'] = $data['body']; - if (\Terminus::get_config("debug")) { + if (\Terminus::get_config('debug')) { \Terminus\Loggers\Regular::debug($data['body']); } } - $options['verify'] = false; $request = $browser->createRequest($method, $url, null, null, $options ); diff --git a/php/Terminus/Site.php b/php/Terminus/Site.php index fe53fffe0..7924b10e9 100755 --- a/php/Terminus/Site.php +++ b/php/Terminus/Site.php @@ -51,9 +51,10 @@ public function __construct($attributes) { # deprecated properties # this->information is deprecated, use $this->attributes $this->information = $this->attributes; - // cosmetic reasons for this - $this->metadata = @$this->attributes->metadata ?: new \stdClass(); - # /deprecated properties + $this->metadata = new \stdClass(); + if (isset($this->attributes->metadata)) { + $this->metadata = $this->attributes->metadata; + } $this->org_memberships = new SiteOrganizationMemberships(array('site' => $this)); $this->user_memberships = new SiteUserMemberships(array('site' => $this)); @@ -526,7 +527,6 @@ public function get($attribute) { } /** -<<<<<<< HEAD * Returns tags from the site/org join * * @return [array] $tags Tags in string format diff --git a/php/Terminus/SitesCache.php b/php/Terminus/SitesCache.php index 21a569f31..fe4760237 100644 --- a/php/Terminus/SitesCache.php +++ b/php/Terminus/SitesCache.php @@ -40,9 +40,10 @@ public function __construct() { private function find($name, $options = array()) { $defaults = array('rebuild' => true); $options = array_merge($defaults, $options); + $all = $this->all(); - if (isset($this->all()[$name])) { - $site_data = $this->all()[$name]; + if (isset($all[$name])) { + $site_data = $all[$name]; return $site_data; } else { if ($options['rebuild']) { diff --git a/php/terminus.php b/php/terminus.php index e9da91547..dc2ee69e2 100755 --- a/php/terminus.php +++ b/php/terminus.php @@ -2,7 +2,7 @@ //Can be used by plugins/themes to check if Terminus is running or not define('Terminus', true); -define('TERMINUS_VERSION', '0.7.0'); +define('TERMINUS_VERSION', '0.7.1'); $source = 'unknown'; if ((PHP_SAPI == 'cli') && isset($argv)) {