From 4792146619e5fc75934b2515aa0b58b779b94ba3 Mon Sep 17 00:00:00 2001 From: Elijah Madden Date: Tue, 1 Apr 2014 17:14:09 +0900 Subject: [PATCH 1/2] use PHP_VERSION and version_compare() where appropriate --- ChromePhp.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ChromePhp.php b/ChromePhp.php index 577b1ce..2e83102 100755 --- a/ChromePhp.php +++ b/ChromePhp.php @@ -78,11 +78,6 @@ class ChromePhp */ const TABLE = 'table'; - /** - * @var string - */ - protected $_php_version; - /** * @var int */ @@ -131,8 +126,7 @@ class ChromePhp */ private function __construct() { - $this->_php_version = phpversion(); - $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time(); + $this->_timestamp = version_compare(PHP_VERSION, '5.1') >= 0 ? $_SERVER['REQUEST_TIME'] : time(); $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; } @@ -318,7 +312,7 @@ protected function _convert($object) } $type = $this->_getPropertyKey($property); - if ($this->_php_version >= 5.3) { + if (version_compare(PHP_VERSION, '5.3') >= 0) { $property->setAccessible(true); } From 7160b4cd1e8e49eb5ea35f08448bc15c54b313ce Mon Sep 17 00:00:00 2001 From: "Theodore R. Smith" Date: Tue, 14 May 2019 21:35:09 -0500 Subject: [PATCH 2/2] Removed support for incredibly dead and buried versions of PHP. Only support PHP 5.6 and later. --- ChromePhp.php | 14 +++----------- composer.json | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ChromePhp.php b/ChromePhp.php index 2e83102..b42deba 100755 --- a/ChromePhp.php +++ b/ChromePhp.php @@ -126,7 +126,7 @@ class ChromePhp */ private function __construct() { - $this->_timestamp = version_compare(PHP_VERSION, '5.1') >= 0 ? $_SERVER['REQUEST_TIME'] : time(); + $this->_timestamp = $_SERVER['REQUEST_TIME']; $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; } @@ -311,16 +311,8 @@ protected function _convert($object) continue; } $type = $this->_getPropertyKey($property); - - if (version_compare(PHP_VERSION, '5.3') >= 0) { - $property->setAccessible(true); - } - - try { - $value = $property->getValue($object); - } catch (ReflectionException $e) { - $value = 'only PHP 5.3 can access private/protected properties'; - } + $property->setAccessible(true); + $value = $property->getValue($object); // same instance as parent object if ($value === $object || in_array($value, $this->_processed, true)) { diff --git a/composer.json b/composer.json index dc16853..bf913e9 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": ">=5.0.0" + "php": ">=5.6" }, "autoload": { "psr-0": {