update v1.0.6

This commit is contained in:
sujitprasad
2016-02-16 22:42:08 +05:30
parent e6b579d67b
commit 073a49a8af
587 changed files with 21487 additions and 22766 deletions

View File

@@ -1,6 +1,7 @@
sudo: false
language: php
php:
- 7.0
- 5.6
- 5.5
- 5.4

View File

@@ -1,6 +1,15 @@
Changelog
=========
2.6.1 (2016-01-28)
-----
### Bug Fixes
* Fixes an error thrown when sending an `Error` instance using PHP 7
[Petr Bugyík](https://github.com/o5)
[#110](https://github.com/bugsnag/bugsnag-php/pull/110)
2.6.0 (23 Dec 2015)
-----

Binary file not shown.

View File

@@ -16,7 +16,7 @@
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"phpunit/phpunit": "~4.8|~5.0"
},
"autoload": {

View File

@@ -18,7 +18,7 @@ class Bugsnag_Configuration
public $proxySettings = array();
public $notifier = array(
'name' => 'Bugsnag PHP (Official)',
'version' => '2.6.0',
'version' => '2.6.1',
'url' => 'https://bugsnag.com',
);
public $sendEnvironment = false;

View File

@@ -96,8 +96,20 @@ class Bugsnag_Error
return $this;
}
public function setPHPException(Exception $exception)
public function setPHPException($exception)
{
if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
if (!$exception instanceof \Throwable) {
error_log('Bugsnag Warning: Exception must implement interface \Throwable.');
return;
}
} else {
if (!$exception instanceof \Exception) {
error_log('Bugsnag Warning: Exception must be instance of \Exception.');
return;
}
}
$this->setName(get_class($exception))
->setMessage($exception->getMessage())
->setStacktrace(Bugsnag_Stacktrace::fromBacktrace($this->config, $exception->getTrace(), $exception->getFile(), $exception->getLine()));

View File

@@ -59,7 +59,7 @@ class Bugsnag_Request
public static function getCurrentUrl()
{
$schema = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
$schema = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)) ? 'https://' : 'http://';
return $schema.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}

View File

@@ -1,5 +1,17 @@
<?php
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
if (PHP_VERSION_ID < 50207) {
define('PHP_MAJOR_VERSION', $version[0]);
define('PHP_MINOR_VERSION', $version[1]);
define('PHP_RELEASE_VERSION', $version[2]);
}
class ClientTest extends PHPUnit_Framework_TestCase
{
/** @var PHPUnit_Framework_MockObject_MockObject|Bugsnag_Client */
@@ -73,11 +85,13 @@ class ClientTest extends PHPUnit_Framework_TestCase
->errorHandler(E_NOTICE, "Something broke", "somefile.php", 123);
}
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testSetInvalidCurlOptions()
{
if (PHP_MAJOR_VERSION >= 7) {
$this->setExpectedException('TypeError');
} else {
$this->setExpectedException('PHPUnit_Framework_Error');
}
$this->client->setCurlOptions("option");
}
}

View File

@@ -128,4 +128,10 @@ class ErrorTest extends Bugsnag_TestCase
$errorArray = $this->error->toArray();
$this->assertArrayNotHasKey('groupingHash', $errorArray);
}
public function testSetPHPException()
{
$exception = version_compare(PHP_VERSION, '7.0.0', '>=') ? new \Error() : new Exception();
$this->error->setPHPException($exception);
}
}