Skip to content

Commit

Permalink
Merge pull request #3931 from MGatner/prep-php8
Browse files Browse the repository at this point in the history
Prep for PHP 8
  • Loading branch information
MGatner authored Nov 28, 2020
2 parents b184bb5 + b5ef7a0 commit d5673f4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parameters:
- system/Commands/Generators/Views/*
- system/Config/Routes.php
- system/Debug/Toolbar/Views/toolbar.tpl.php
- system/Images/Handlers/GDHandler.php
- system/ThirdParty/*
- system/Validation/Views/single.php
ignoreErrors:
Expand Down
10 changes: 5 additions & 5 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ protected function handleRequest(RouteCollectionInterface $routes = null, Cache
{
$controller = $this->createController();

if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false))
{
throw PageNotFoundException::forMethodNotFound($this->method);
}

// Is there a "post_controller_constructor" event?
Events::trigger('post_controller_constructor');

Expand Down Expand Up @@ -890,11 +895,6 @@ protected function startController()
{
throw PageNotFoundException::forControllerNotFound($this->controller, $this->method);
}
if (! method_exists($this->controller, '_remap') &&
! is_callable([$this->controller, $this->method], false))
{
throw PageNotFoundException::forMethodNotFound($this->method);
}
}

//--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion system/Database/MySQLi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function connect(bool $persistent = false)
if ($this->encrypt['ssl_verify'])
{
defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') &&
$this->mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$this->mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 1);
}
// Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
// to FALSE didn't do anything, so PHP 5.6.16 introduced yet another
Expand Down
2 changes: 1 addition & 1 deletion system/Log/Handlers/ChromeLoggerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function handle($level, $message): bool
$message = $this->format($message);

// Generate Backtrace info
$backtrace = debug_backtrace(false, $this->backtraceLevel);
$backtrace = debug_backtrace(0, $this->backtraceLevel);
$backtrace = end($backtrace);

$backtraceMessage = 'unknown';
Expand Down
2 changes: 1 addition & 1 deletion system/Test/ReflectionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ public static function setPrivateProperty($obj, $property, $value)
public static function getPrivateProperty($obj, $property)
{
$refProperty = self::getAccessibleRefProperty($obj, $property);
return $refProperty->getValue($obj);
return is_string($obj) ? $refProperty->getValue() : $refProperty->getValue($obj);
}
}
4 changes: 0 additions & 4 deletions tests/system/Cache/Handlers/FileHandlerTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?php
namespace CodeIgniter\Cache\Handlers;

set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) {
//throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
});

class FileHandlerTest extends \CodeIgniter\Test\CIUnitTestCase
{

Expand Down
4 changes: 2 additions & 2 deletions tests/system/Helpers/URLHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public function mailtoPatterns()
/**
* @dataProvider mailtoPatterns
*/
public function testMailto($expected = '', $email, $title = '', $attributes = '')
public function testMailto($expected = '', $email = '', $title = '', $attributes = '')
{
$request = Services::request($this->config);
$request->uri = new URI('http://example.com/');
Expand Down Expand Up @@ -912,7 +912,7 @@ public function safeMailtoPatterns()
/**
* @dataProvider safeMailtoPatterns
*/
public function testSafeMailto($expected = '', $email, $title = '', $attributes = '')
public function testSafeMailto($expected = '', $email = '', $title = '', $attributes = '')
{
$request = Services::request($this->config);
$request->uri = new URI('http://example.com/');
Expand Down

0 comments on commit d5673f4

Please sign in to comment.