From eb03759ecad818373da14b15d8e3ff409dfc1821 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 4 Jun 2015 05:13:01 +0700 Subject: [PATCH 1/2] drop PHP 5.4 check --- src/Processor/Backtrace.php | 6 +----- src/Processor/RequestId.php | 4 +--- test/LoggerAwareTraitTest.php | 3 --- test/LoggerTest.php | 10 ++++------ 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/Processor/Backtrace.php b/src/Processor/Backtrace.php index 304bebd2..c25c0ccd 100644 --- a/src/Processor/Backtrace.php +++ b/src/Processor/Backtrace.php @@ -66,10 +66,6 @@ public function process(array $event) */ protected function getBacktrace() { - if (PHP_VERSION_ID >= 50400) { - return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $this->traceLimit); - } - - return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $this->traceLimit); } } diff --git a/src/Processor/RequestId.php b/src/Processor/RequestId.php index 3187bb44..9a6acd02 100644 --- a/src/Processor/RequestId.php +++ b/src/Processor/RequestId.php @@ -53,9 +53,7 @@ protected function getIdentifier() return $this->identifier; } - $requestTime = (PHP_VERSION_ID >= 50400) - ? $_SERVER['REQUEST_TIME_FLOAT'] - : $_SERVER['REQUEST_TIME']; + $requestTime = $_SERVER['REQUEST_TIME_FLOAT']; if (Console::isConsole()) { $this->identifier = md5($requestTime); diff --git a/test/LoggerAwareTraitTest.php b/test/LoggerAwareTraitTest.php index 4714675c..ef47da14 100644 --- a/test/LoggerAwareTraitTest.php +++ b/test/LoggerAwareTraitTest.php @@ -12,9 +12,6 @@ use PHPUnit_Framework_TestCase as TestCase; use Zend\Log\Logger; -/** - * @requires PHP 5.4 - */ class LoggerAwareTraitTest extends TestCase { public function testSetLogger() diff --git a/test/LoggerTest.php b/test/LoggerTest.php index a71086b7..a5350162 100644 --- a/test/LoggerTest.php +++ b/test/LoggerTest.php @@ -457,9 +457,8 @@ public function testRegisterFatalShutdownFunction() // check for single error handler instance $this->assertFalse(Logger::registerFatalErrorShutdownFunction($this->logger)); - $self = $this; - register_shutdown_function(function () use ($writer, $self, &$caught) { - $self->assertEquals( + register_shutdown_function(function () use ($writer) { + $this->assertEquals( 'Call to undefined method ZendTest\Log\LoggerTest::callToNonExistingMethod()', $writer->events[0]['message'] ); @@ -489,9 +488,8 @@ public function testRegisterFatalErrorShutdownFunctionHandlesCompileTimeErrors() // check for single error handler instance $this->assertFalse(Logger::registerFatalErrorShutdownFunction($this->logger)); - $self = $this; - register_shutdown_function(function () use ($writer, $self, &$caught) { - $self->assertStringMatchesFormat( + register_shutdown_function(function () use ($writer) { + $this->assertStringMatchesFormat( 'syntax error%A', $writer->events[0]['message'] ); From c805b77e92513f640029f6369d7bacfcb42f99d4 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 6 Jul 2015 16:21:26 -0500 Subject: [PATCH 2/2] Updated CHANGELOG for #1 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10095d06..2f61e433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,3 +40,6 @@ All notable changes to this project will be documented in this file, in reverse - [#4](https://github.com/zendframework/zend-log/pull/4) adds better, more complete verbiage to the `composer.json` `suggest` section, to detail why and when you might need additional dependencies. +- [#1](https://github.com/zendframework/zend-log/pull/1) updates the code to + remove conditionals related to PHP versions prior to PHP 5.5, and use bound + closures in tests (not possible before 5.5).