Skip to content

Commit

Permalink
Merge branch '5.6' into 5.6-html-mail
Browse files Browse the repository at this point in the history
  • Loading branch information
abellion committed Jan 17, 2018
2 parents 6ca7a86 + cc57a52 commit 055f50c
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 24 deletions.
22 changes: 21 additions & 1 deletion CHANGELOG-5.5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Release Notes for 5.5.x

## [Unreleased]
## v5.5.31 (2018-01-16)

### Fixed
- Reverted [#22804](https://github.com/laravel/framework/pull/22804) ([d8a8368](https://github.com/laravel/framework/commit/d8a8368e15e73de50b91b903f6b933c7d05b0e28), [f34926c](https://github.com/laravel/framework/commit/f34926c52ba282ff67f4be3e9afc8d0ddc885c3f), [#22817](https://github.com/laravel/framework/pull/22817))


## v5.5.30 (2018-01-16)

### Changed
- Accept collection of keys on `Collection::only()` ([#22804](https://github.com/laravel/framework/pull/22804))

### Fixed
- Reverted [#22649](https://github.com/laravel/framework/pull/22649) ([#22815](https://github.com/laravel/framework/pull/22815))
- Send status code `500` when using `Collection::dd()` ([#22803](https://github.com/laravel/framework/pull/22803))


## v5.5.29 (2018-01-15)

### Added
- Added `Model::qualifyColumn()` method ([#22577](https://github.com/laravel/framework/pull/22577))
Expand All @@ -23,13 +39,17 @@
- Set `null` as default value for `optional()` helper ([#22699](https://github.com/laravel/framework/pull/22699))
- Make sure `getRememberToken()` returns a string ([#22724](https://github.com/laravel/framework/pull/22724))
- Updated Vue preset version ([#22732](https://github.com/laravel/framework/pull/22732))
- Accept `Arrayable` items in `Collection::find()` ([#22787](https://github.com/laravel/framework/pull/22787))

### Fixed
- Close database connection when using `RefreshDatabase` trait ([#22569](https://github.com/laravel/framework/pull/22569))
- Send status code `500` when using `dd()` ([#22581](https://github.com/laravel/framework/pull/22581))
- Fixed parameter usage in `RedirectController` ([#22657](https://github.com/laravel/framework/pull/22657))
- Added `__set_state()` method to `Support/Carbon` ([#22689](https://github.com/laravel/framework/pull/22689))
- Do not continue checking `APP_ENV` if environment file path being set successfully with `--env` option ([#22753](https://github.com/laravel/framework/pull/22753))
- Fixed missing table prefix in `SQLiteGrammar::compileDropColumn()` ([#22745](https://github.com/laravel/framework/pull/22745), [c13322c](https://github.com/laravel/framework/commit/c13322c54a20de1417d7bf53e348a601c526bf54))
- Fixed prefixing in `SQLiteGrammar::compileColumnListing()` ([#22781](https://github.com/laravel/framework/pull/22781))


## v5.5.28 (2017-12-26)

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"nesbot/carbon": "~1.20",
"psr/container": "~1.0",
"psr/simple-cache": "^1.0",
"ramsey/uuid": "~3.0",
"ramsey/uuid": "^3.7",
"swiftmailer/swiftmailer": "~6.0",
"symfony/console": "~4.0",
"symfony/debug": "~4.0",
Expand Down Expand Up @@ -75,6 +75,7 @@
"doctrine/dbal": "~2.6",
"filp/whoops": "^2.1.4",
"mockery/mockery": "~1.0",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "3.6.*",
"pda/pheanstalk": "~3.0",
"phpunit/phpunit": "~6.0",
Expand Down
2 changes: 0 additions & 2 deletions src/Illuminate/Auth/RequestGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ public function validate(array $credentials = [])
*/
public function setRequest(Request $request)
{
$this->user = null;

$this->request = $request;

return $this;
Expand Down
13 changes: 12 additions & 1 deletion src/Illuminate/Contracts/Routing/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,22 @@ public function jsonp($callback, $data = [], $status = 200, array $headers = [],
*/
public function stream($callback, $status = 200, array $headers = []);

/**
* Return a new streamed response as a file download from the application.
*
* @param \Closure $callback
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment');

/**
* Create a new file download response.
*
* @param \SplFileInfo|string $file
* @param string $name
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
Expand Down
20 changes: 10 additions & 10 deletions src/Illuminate/Cookie/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class CookieJar implements JarContract
* @param int $minutes
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool|null $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null)
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
{
list($path, $domain, $secure, $sameSite) = $this->getPathAndDomain($path, $domain, $secure, $sameSite);

Expand All @@ -76,13 +76,13 @@ public function make($name, $value, $minutes = 0, $path = null, $domain = null,
* @param string $value
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool|null $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null)
public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
{
return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
}
Expand Down Expand Up @@ -154,15 +154,15 @@ public function unqueue($name)
/**
* Get the path and domain, or the default values.
*
* @param string $path
* @param string $domain
* @param bool $secure
* @param string $sameSite
* @param string $path
* @param string $domain
* @param bool|null $secure
* @param string $sameSite
* @return array
*/
protected function getPathAndDomain($path, $domain, $secure = false, $sameSite = null)
protected function getPathAndDomain($path, $domain, $secure = null, $sameSite = null)
{
return [$path ?: $this->path, $domain ?: $this->domain, $secure ?: $this->secure, $sameSite ?: $this->sameSite];
return [$path ?: $this->path, $domain ?: $this->domain, is_bool($secure) ? $secure : $this->secure, $sameSite ?: $this->sameSite];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use Faker\Generator as Faker;

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(DummyModel::class, function (Faker $faker) {
return [
//
Expand Down
19 changes: 17 additions & 2 deletions src/Illuminate/Log/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public function driver($driver = null)
protected function get($name)
{
try {
return $this->stores[$name] ?? with($this->resolve($name), function ($monolog) use ($name) {
return $this->tap($name, new Logger($monolog, $this->app['events']));
return $this->stores[$name] ?? with($this->resolve($name), function ($logger) use ($name) {
return $this->tap($name, new Logger($logger, $this->app['events']));
});
} catch (Throwable $e) {
return tap($this->createEmergencyLogger(), function ($logger) use ($e) {
Expand Down Expand Up @@ -200,6 +200,21 @@ protected function createCustomDriver(array $config)
return $this->app->make($config['via'])->__invoke($config);
}

/**
* Create a aggregate log driver instance.
*
* @param array $config
* @return \Psr\Log\LoggerInterface
*/
protected function createAggregateDriver(array $config)
{
$handlers = collect($config['channels'])->flatMap(function ($channel) {
return $this->channel($channel)->getHandlers();
})->all();

return new Monolog($this->parseChannel($config), $handlers);
}

/**
* Create an instance of the single file log driver.
*
Expand Down
39 changes: 37 additions & 2 deletions src/Illuminate/Routing/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,35 @@ public function stream($callback, $status = 200, array $headers = [])
return new StreamedResponse($callback, $status, $headers);
}

/**
* Return a new streamed response as a file download from the application.
*
* @param \Closure $callback
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
{
$response = new StreamedResponse($callback, 200, $headers);

if (! is_null($name)) {
$response->headers->set('Content-Disposition', $response->headers->makeDisposition(
$disposition,
$name,
$this->fallbackName($name)
));
}

return $response;
}

/**
* Create a new file download response.
*
* @param \SplFileInfo|string $file
* @param string $name
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
Expand All @@ -125,12 +149,23 @@ public function download($file, $name = null, array $headers = [], $disposition
$response = new BinaryFileResponse($file, 200, $headers, true, $disposition);

if (! is_null($name)) {
return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name)));
return $response->setContentDisposition($disposition, $name, $this->fallbackName($name));
}

return $response;
}

/**
* Conver the string to ASCII characters that are equivalent to the given name.
*
* @param string $name
* @return string
*/
protected function fallbackName($name)
{
return str_replace('%', '', Str::ascii($name));
}

/**
* Return the raw contents of a binary file.
*
Expand Down
10 changes: 8 additions & 2 deletions src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ public function crossJoin(...$lists)
*/
public function dd(...$args)
{
http_response_code(500);

call_user_func_array([$this, 'dump'], $args);

die(1);
Expand Down Expand Up @@ -391,7 +393,7 @@ public function every($key, $operator = null, $value = null)
public function except($keys)
{
if ($keys instanceof self) {
$keys = $keys->keys()->all();
$keys = $keys->all();
} elseif (! is_array($keys)) {
$keys = func_get_args();
}
Expand Down Expand Up @@ -642,7 +644,7 @@ public function forget($keys)
*/
public function get($key, $default = null)
{
return Arr::get($this->items, $key, $default);
return is_null($key) ? null : Arr::get($this->items, $key, $default);
}

/**
Expand Down Expand Up @@ -1070,6 +1072,10 @@ public function only($keys)
return new static($this->items);
}

if ($keys instanceof self) {
$keys = $keys->all();
}

$keys = is_array($keys) ? $keys : func_get_args();

return new static(Arr::only($this->items, $keys));
Expand Down
35 changes: 35 additions & 0 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

namespace Illuminate\Support;

use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidFactory;
use Illuminate\Support\Traits\Macroable;
use Ramsey\Uuid\Generator\CombGenerator;
use Ramsey\Uuid\Codec\TimestampFirstCombCodec;

class Str
{
Expand Down Expand Up @@ -517,6 +521,37 @@ public static function ucfirst($string)
return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
}

/**
* Generate a UUID (version 4).
*
* @return \Ramsey\Uuid\Uuid
*/
public static function uuid()
{
return Uuid::uuid4();
}

/**
* Generate a time-ordered UUID (version 4).
*
* @return \Ramsey\Uuid\Uuid
*/
public static function orderedUuid()
{
$factory = new UuidFactory;

$factory->setRandomGenerator(new CombGenerator(
$factory->getRandomGenerator(),
$factory->getNumberConverter()
));

$factory->setCodec(new TimestampFirstCombCodec(
$factory->getUuidBuilder()
));

return $factory->uuid4();
}

/**
* Returns the replacements for the ascii method.
*
Expand Down
12 changes: 12 additions & 0 deletions tests/Cookie/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public function testCookiesAreCreatedWithProperOptionsUsingDefaultPathAndDomain(
$this->assertEquals('lax', $c->getSameSite());
}

public function testCookiesCanSetSecureOptionUsingDefaultPathAndDomain()
{
$cookie = $this->getCreator();
$cookie->setDefaultPathAndDomain('/path', '/domain', true, 'lax');
$c = $cookie->make('color', 'blue', 10, null, null, false);
$this->assertEquals('blue', $c->getValue());
$this->assertFalse($c->isSecure());
$this->assertEquals('/domain', $c->getDomain());
$this->assertEquals('/path', $c->getPath());
$this->assertEquals('lax', $c->getSameSite());
}

public function testQueuedCookies()
{
$cookie = $this->getCreator();
Expand Down
Loading

0 comments on commit 055f50c

Please sign in to comment.