Skip to content

Commit

Permalink
Merge branch '6.x' into 7.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Illuminate/Foundation/Application.php
#	src/Illuminate/Support/Facades/DB.php
#	src/Illuminate/View/Engines/CompilerEngine.php
  • Loading branch information
driesvints committed Mar 4, 2021
2 parents c7c9d4e + a817662 commit 7f7c057
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 17 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
linux_tests:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04

services:
memcached:
Expand All @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4, 8.0]
php: ['7.2', '7.3', '7.4', '8.0']
stability: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
Expand All @@ -48,9 +48,6 @@ jobs:
tools: composer:v2
coverage: none

- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Set Minimum Guzzle Version
uses: nick-invision/retry@v1
with:
Expand Down Expand Up @@ -78,7 +75,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4, 8.0]
php: ['7.2', '7.3', '7.4', '8.0']
stability: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
Expand All @@ -100,9 +97,6 @@ jobs:
tools: composer:v2
coverage: none

- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Set Minimum Guzzle Version
uses: nick-invision/retry@v1
with:
Expand Down
31 changes: 30 additions & 1 deletion CHANGELOG-6.x.md
@@ -1,6 +1,35 @@
# Release Notes for 6.x

## [Unreleased](https://github.com/laravel/framework/compare/v6.20.13...6.x)
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.17...6.x)


## [v6.20.17 (2021-03-02)](https://github.com/laravel/framework/compare/v6.20.16...v6.20.17)

### Added
- Added new line to `DetectsLostConnections` ([#36373](https://github.com/laravel/framework/pull/36373))


## [v6.20.16 (2021-02-02)](https://github.com/laravel/framework/compare/v6.20.15...v6.20.16)

### Fixed
- Fixed `Illuminate\View\ViewException::report()` ([#36110](https://github.com/laravel/framework/pull/36110))
- Fixed `Illuminate\Redis\Connections\PhpRedisConnection::spop()` ([#36106](https://github.com/laravel/framework/pull/36106))

### Changed
- Typecast page number as integer in `Illuminate\Pagination\AbstractPaginator::resolveCurrentPage()` ([#36055](https://github.com/laravel/framework/pull/36055))


## [v6.20.15 (2021-01-26)](https://github.com/laravel/framework/compare/v6.20.14...v6.20.15)

### Changed
- Pipe new through render and report exception methods ([#36037](https://github.com/laravel/framework/pull/36037))


## [v6.20.14 (2021-01-21)](https://github.com/laravel/framework/compare/v6.20.13...v6.20.14)

### Fixed
- Fixed type error in `Illuminate\Http\Concerns\InteractsWithContentTypes::isJson()` ([#35956](https://github.com/laravel/framework/pull/35956))
- Limit expected bindings ([#35972](https://github.com/laravel/framework/pull/35972), [006873d](https://github.com/laravel/framework/commit/006873df411d28bfd03fea5e7f91a2afe3918498))


## [v6.20.13 (2021-01-19)](https://github.com/laravel/framework/compare/v6.20.12...v6.20.13)
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Database/DetectsLostConnections.php
Expand Up @@ -49,6 +49,7 @@ protected function causedByLostConnection(Throwable $e)
'SQLSTATE[HY000] [2002] Connection timed out',
'SSL: Connection timed out',
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
'Temporary failure in name resolution',
]);
}
}
Expand Up @@ -9,7 +9,7 @@ class DummyClass extends Exception
/**
* Report the exception.
*
* @return void
* @return bool|null
*/
public function report()
{
Expand Down
Expand Up @@ -9,7 +9,7 @@ class DummyClass extends Exception
/**
* Report the exception.
*
* @return void
* @return bool|null
*/
public function report()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Pagination/AbstractPaginator.php
Expand Up @@ -481,7 +481,7 @@ public static function currentPathResolver(Closure $resolver)
public static function resolveCurrentPage($pageName = 'page', $default = 1)
{
if (isset(static::$currentPageResolver)) {
return call_user_func(static::$currentPageResolver, $pageName);
return (int) call_user_func(static::$currentPageResolver, $pageName);
}

return $default;
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Redis/Connections/PhpRedisConnection.php
Expand Up @@ -198,7 +198,7 @@ public function brpop(...$arguments)
*/
public function spop($key, $count = 1)
{
return $this->command('spop', [$key, $count]);
return $this->command('spop', func_get_args());
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Support/Facades/DB.php
Expand Up @@ -6,10 +6,12 @@
* @method static \Illuminate\Database\ConnectionInterface connection(string $name = null)
* @method static \Illuminate\Database\Query\Builder table(string $table, string $as = null)
* @method static \Illuminate\Database\Query\Expression raw($value)
* @method static array getQueryLog()
* @method static array prepareBindings(array $bindings)
* @method static array pretend(\Closure $callback)
* @method static array select(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static bool insert(string $query, array $bindings = [])
* @method static bool logging()
* @method static bool statement(string $query, array $bindings = [])
* @method static bool unprepared(string $query)
* @method static int affectingStatement(string $query, array $bindings = [])
Expand All @@ -21,6 +23,9 @@
* @method static string getDefaultConnection()
* @method static void beginTransaction()
* @method static void commit()
* @method static void enableQueryLog()
* @method static void disableQueryLog()
* @method static void flushQueryLog()
* @method static void listen(\Closure $callback)
* @method static void rollBack(int $toLevel = null)
* @method static void setDefaultConnection(string $name)
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/View/Engines/CompilerEngine.php
Expand Up @@ -2,9 +2,9 @@

namespace Illuminate\View\Engines;

use ErrorException;
use Illuminate\View\Compilers\CompilerInterface;
use Throwable;
use Illuminate\View\ViewException;

class CompilerEngine extends PhpEngine
{
Expand Down Expand Up @@ -72,7 +72,7 @@ public function get($path, array $data = [])
*/
protected function handleViewException(Throwable $e, $obLevel)
{
$e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e);
$e = new ViewException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e);

parent::handleViewException($e, $obLevel);
}
Expand Down
41 changes: 41 additions & 0 deletions src/Illuminate/View/ViewException.php
@@ -0,0 +1,41 @@
<?php

namespace Illuminate\View;

use ErrorException;
use Illuminate\Container\Container;
use Illuminate\Support\Reflector;

class ViewException extends ErrorException
{
/**
* Report the exception.
*
* @return bool|null
*/
public function report()
{
$exception = $this->getPrevious();

if (Reflector::isCallable($reportCallable = [$exception, 'report'])) {
return Container::getInstance()->call($reportCallable);
}

return false;
}

/**
* Render the exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function render($request)
{
$exception = $this->getPrevious();

if ($exception && method_exists($exception, 'render')) {
return $exception->render($request);
}
}
}
36 changes: 36 additions & 0 deletions tests/Integration/View/RenderableViewExceptionTest.php
@@ -0,0 +1,36 @@
<?php

namespace Illuminate\Tests\Integration\View;

use Exception;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\View;
use Orchestra\Testbench\TestCase;

class RenderableViewExceptionTest extends TestCase
{
public function testRenderMethodOfExceptionThrownInViewGetsHandled()
{
Route::get('/', function () {
return View::make('renderable-exception');
});

$response = $this->get('/');

$response->assertSee('This is a renderable exception.');
}

protected function getEnvironmentSetUp($app)
{
$app['config']->set('view.paths', [__DIR__.'/templates']);
}
}

class RenderableException extends Exception
{
public function render($request)
{
return new Response('This is a renderable exception.');
}
}
@@ -0,0 +1,3 @@
@php
throw new Illuminate\Tests\Integration\View\RenderableException;
@endphp
27 changes: 27 additions & 0 deletions tests/Redis/RedisConnectionTest.php
Expand Up @@ -698,6 +698,33 @@ public function testItSscansForKeys()
}
}

public function testItSPopsForKeys()
{
foreach ($this->connections() as $redis) {
$members = ['test:spop:1', 'test:spop:2', 'test:spop:3', 'test:spop:4'];

foreach ($members as $member) {
$redis->sadd('set', $member);
}

$result = $redis->spop('set');
$this->assertIsNotArray($result);
$this->assertContains($result, $members);

$result = $redis->spop('set', 1);

$this->assertIsArray($result);
$this->assertCount(1, $result);

$result = $redis->spop('set', 2);

$this->assertIsArray($result);
$this->assertCount(2, $result);

$redis->flushAll();
}
}

public function testPhpRedisScanOption()
{
foreach ($this->connections() as $redis) {
Expand Down
1 change: 0 additions & 1 deletion tests/View/fixtures/nested/basic.php
@@ -1 +0,0 @@
Hello World

0 comments on commit 7f7c057

Please sign in to comment.