diff --git a/.travis.yml b/.travis.yml
index b765a07..b3f4f49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,6 @@
language: php
sudo: false
php:
- - 5.4
- - 5.5
- - 5.6
- 7
- 7.1
- 7.2
diff --git a/Panda.php b/Panda.php
index 17d8c54..fb70e08 100644
--- a/Panda.php
+++ b/Panda.php
@@ -469,7 +469,7 @@ public static function onPearError(PEAR_Error $error)
$userInfo = $error->getUserInfo();
$trace = ($error->getBackTrace());
$info = array('Error Type' => $error->getType(),
- 'Debug Info' => $error->getUserInfo());
+ 'Debug Info' => ''); //$error->getUserInfo()
if ($debugInfo !== $userInfo) {
$info['User Info'] = $userInfo;
}
@@ -603,8 +603,11 @@ public static function onLivePhpError($code, $message, $file, $line, array $errc
*
* @return void
*/
- public static function onException(Exception $e, $httpScreenOutput = true)
+ public static function onException($e, $httpScreenOutput = true)
{
+ if (! $e instanceof Exception) {
+ throw $e;
+ }
try {
$class = get_class($e);
$body = null;
diff --git a/Panda/vendors/debuglib.php b/Panda/vendors/debuglib.php
index fa7318e..281f15a 100644
--- a/Panda/vendors/debuglib.php
+++ b/Panda/vendors/debuglib.php
@@ -378,14 +378,9 @@ public static function trim_leading_tabs( $string, $tab_padding = NULL ) {
public static function _handle_whitespace( $string ) {
// replace 2 or more spaces with nobreaks (for special markup)
- $string = preg_replace_callback(
- '/ {2,}/',
- create_function(
- '$matches',
- 'return str_repeat(" ", strlen($matches[0]));'
- ),
- $string
- );
+ $string = preg_replace_callback('/ {2,}/', function($matches) {
+ return str_repeat(" ", strlen($matches[0]));
+ }, $string);
$string = preg_replace(array('/ $/', '/^ /'), ' ', $string); # mark spaces at the start/end of the string with red underscores
$string = str_replace("\t", ' ', $string); # replace tabulators with ' ยป'
diff --git a/composer.json b/composer.json
index 4afe803..76d25ce 100644
--- a/composer.json
+++ b/composer.json
@@ -1,31 +1,31 @@
{
- "name": "bearsaturday/panda",
- "description": "Panda is a PHP error handler.",
- "license": "BSD-3-Clause",
- "authors": [
- {
- "name": "Akihito Koriyama",
- "email": "akihito.koriyama@gmail.com"
+ "name": "bearsaturday/panda",
+ "description": "Panda is a PHP error handler.",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Akihito Koriyama",
+ "email": "akihito.koriyama@gmail.com"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "pear",
+ "url": "http://pear.php.net"
+ }
+ ],
+ "require": {
+ "php": ">=7.0.0",
+ "pear-pear.php.net/pear": "^1.10"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7"
+ },
+ "autoload": {
+ "classmap": ["Panda"],
+ "files": ["./Panda.php"]
+ },
+ "config":{
+ "secure-http" : false
}
- ],
- "repositories": [
- {
- "type": "pear",
- "url": "http://pear.php.net"
- }
- ],
- "require": {
- "php": ">=5.4.0",
- "pear-pear.php.net/pear": "^1.10"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.8",
- "doctrine/instantiator": "~1.0.5"
- },
- "include-path": [
- "./"
- ],
- "config":{
- "secure-http" : false
- }
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 19787fa..45ec1c7 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -4,12 +4,4 @@
tests
-
-
- src
-
-
-
-
-
diff --git a/tests/Test/Panda/PandaTest.php b/tests/Test/Panda/PandaTest.php
index 9820c80..43f7206 100644
--- a/tests/Test/Panda/PandaTest.php
+++ b/tests/Test/Panda/PandaTest.php
@@ -1,301 +1,30 @@
false,
- Panda::CONFIG_VALID_PATH => array('/'),
- Panda::CONFIG_LOG_PATH => '/tmp',
- Panda::CONFIG_ON_ERROR_FIRED => false,
- Panda::CONFIG_ON_FATAL_ERROR => 'Panda/template/fatal.html',
- Panda::CONFIG_ENABLE_FIREPHP => true,
- Panda::CONFIG_FATAL_HTML => 'Panda/template/fatal.html',
- Panda::CONFIG_HTTP_TPL => 'Panda/template/http.php',
- Panda::CONFIG_CATCH_FATAL => false,
- Panda::CONFIG_CATCH_STRICT => true,
- Panda::CONFIG_PANDA_PATH => '/',
- Panda::CONFIG_EDITOR => 0);
+ $config = [
+ Panda::CONFIG_DEBUG => false,
+ Panda::CONFIG_VALID_PATH => ['/'],
+ Panda::CONFIG_LOG_PATH => '/tmp',
+ Panda::CONFIG_ON_ERROR_FIRED => false,
+ Panda::CONFIG_ON_FATAL_ERROR => 'Panda/template/fatal.html',
+ Panda::CONFIG_ENABLE_FIREPHP => true,
+ Panda::CONFIG_FATAL_HTML => 'Panda/template/fatal.html',
+ Panda::CONFIG_HTTP_TPL => 'Panda/template/http.php',
+ Panda::CONFIG_CATCH_FATAL => false,
+ Panda::CONFIG_CATCH_STRICT => true,
+ Panda::CONFIG_PANDA_PATH => '/',
+ Panda::CONFIG_EDITOR => 0
+ ];
Panda::init($config);
}
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
-
- /**
- */
public function testGetConfig()
{
$config = Panda::getConfig();
$this->assertTrue(isset($config[Panda::CONFIG_DEBUG]));
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testInit().
- */
- public function testInit()
- {
- $config = Panda::getConfig();
- $config[Panda::CONFIG_DEBUG] = true;
- Panda::init($config);
- $config = Panda::getConfig();
- $this->assertTrue($config[Panda::CONFIG_DEBUG] === true);
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testRestoreHandler().
- */
- public function testRestoreHandler()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnAssert().
- */
- public function testOnAssert()
- {
- // $config = Panda::getConfig();
- // $config[Panda::CONFIG_DEBUG] = true;
- // Panda::init($config);
- //assert(false);
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnStackError().
- */
- public function testOnStackError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnPearError().
- */
- public function testOnPearError()
- {
- if (version_compare(PHP_VERSION, '5.5', '>=')) {
- $last_handler = set_exception_handler(null);
- $this->assertSame('Panda', $last_handler[0]);
- $this->assertSame('onException', $last_handler[1]);
- }
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnDebugPhpError().
- */
- public function testOnDebugPhpError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnLivePhpError().
- */
- public function testOnLivePhpError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnException().
- */
- public function testOnException()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testIsValidPath().
- */
- public function testIsValidPath()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testIsCliOutput().
- */
- public function testIsCliOutput()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testError().
- */
- public function testError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testMessage().
- */
- public function testMessage()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement test_getFileSummary().
- */
- public function test_getFileSummary()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testGetEditorLink().
- */
- public function testGetEditorLink()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnFatalError().
- */
- public function testOnFatalError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOnStrictError().
- */
- public function testOnStrictError()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testOutputHttpStatus().
- */
- public function testOutputHttpStatus()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testGetErrorStat().
- */
- public function testGetErrorStat()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testGetTempDir().
- */
- public function testGetTempDir()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @runInSeparateProcess
- * @todo Implement testGetOuterPathErrors().
- */
- public function testGetOuterPathErrors()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->assertFalse($config[Panda::CONFIG_DEBUG]);
}
}
-?>