Skip to content

Commit

Permalink
Merge branch 'upstream/5.5' into 5.5
Browse files Browse the repository at this point in the history
* upstream/5.5: (84 commits)
  Correct docBlock depenency on syncWithoutDetaching (laravel#21478)
  update v5.5 changelog
  allow to specify the queue while scheduling of queued jobs (laravel#21473)
  [5.5] Clear CountQuery "select" bindings since we're overriding the columns anyway (laravel#21468)
  add interface
  access pivot on resource
  update v5.5 changelog
  extract trait
  Fix docblock in Route (laravel#21454)
  fix test
  formatting
  Fix Relation::morphMap() merge (issue laravel#21457). (laravel#21458)
  extract AnonymousResourceCollection into class to allow serialization
  revert relationship limits
  Fix spelling of 'optionally'
  [5.5] Fix Collection::contains() when the found value is null (laravel#21442)
  Allow passing a callback to "with" (laravel#21445)
  [5.5] Add relation and model attributes in RelationNotFoundException (laravel#21426)
  [5.5] Make sure sql for virtual columns is added after the unsigned modifier (laravel#21441)
  vendor:publish options alphabetized (laravel#21412)
  ...
  • Loading branch information
edmandiesamonte committed Oct 2, 2017
2 parents e6f99a2 + 00fce7e commit 34c97ae
Show file tree
Hide file tree
Showing 49 changed files with 777 additions and 290 deletions.
76 changes: 76 additions & 0 deletions CHANGELOG-5.5.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,81 @@
# Release Notes for 5.5.x

## [Unreleased]

### Added
- Allow testing anonymous notifiables ([#21379](https://github.com/laravel/framework/pull/21379))
- Add relation and model attributes on `RelationNotFoundException` ([#21426](https://github.com/laravel/framework/pull/21426))
- Allow passing a callback to `with()` ([#21445](https://github.com/laravel/framework/pull/21445))
- Added `PotentiallyMissing` interface to `MissingValue` class ([be7dccc](https://github.com/laravel/framework/commit/be7dccca9f9249c928108d957fe70e78d370d26e))
- Accept `$queue` name on `Schedule::job()` ([#21473](https://github.com/laravel/framework/pull/21473))

### Changed
- Reset RefreshDatabaseState after DatabaseMigrations rolls back ([#21325](https://github.com/laravel/framework/pull/21325))
- Make sure page resolver returns an integer ([#21378](https://github.com/laravel/framework/pull/21378))
- Allow single error messages in `ValidationException::withMessages()` ([#21400](https://github.com/laravel/framework/pull/21400))
- Revert `Collection::sortBy()` behaviour to 5.4 ([#21382](https://github.com/laravel/framework/pull/21382))
- Use fill instead of forceFill while storing pivot attributes ([#21403](https://github.com/laravel/framework/pull/21403))
- Alphabetize `vendor:publish` options ([#21412](https://github.com/laravel/framework/pull/21412))
- Extract `AnonymousResourceCollection` into class to allow serialization ([#21456](https://github.com/laravel/framework/pull/21456))
- Extract some methods from `Resource` into `ConditionallyLoadsAttributes` trait ([28d945e](https://github.com/laravel/framework/commit/28d945e557736598c10c492c2918d5697b70570d), [1f37ccc](https://github.com/laravel/framework/commit/1f37ccc06485410fa0866c012b083a042c4cc73e))

### Fixed
- Ensure user is logged in before expecting user instance ([#21377](https://github.com/laravel/framework/pull/21377))
- Remove leading slash from class while resolving controllers ([#21407](https://github.com/laravel/framework/pull/21407))
- Make sure SQL for virtual columns is added after the unsigned modifier ([#21441](https://github.com/laravel/framework/pull/21441))
- Fixed `Collection::contains()` when the found value is `null` ([#21442](https://github.com/laravel/framework/pull/21442))
- Fixed merge issue in `Relation::morphMap()` ([#21458](https://github.com/laravel/framework/pull/21458))
- Clear count query select bindings in `Relation::getRelationExistenceCountQuery()` ([#21468](https://github.com/laravel/framework/pull/21468))


## v5.5.13 (2017-09-24)

### Added
- Added optional config option for whoops blacklist ([#21336](https://github.com/laravel/framework/pull/21336), [a83ebc1](https://github.com/laravel/framework/commit/a83ebc15e768fab3955013bf5797fa090ee693d7))
- Added `Collection::pad()` method ([#21342](https://github.com/laravel/framework/pull/21342))

### Changed
- Made `$callback` parameter of `Arr::sort()` optional ([#21337](https://github.com/laravel/framework/pull/21337))
- Support setting custom `REMOTE_ADDR` in `MakesHttpRequests` ([#21351](https://github.com/laravel/framework/pull/21351))
- Changed visibility of `$output` to public on console events ([#21356](https://github.com/laravel/framework/pull/21356))

### Fixed
- Don't compare remember token in user providers if it's `null` (srsly for real this time, pinky promise) ([#21328](https://github.com/laravel/framework/pull/21328), [#21368](https://github.com/laravel/framework/pull/21368))


## v5.5.12 (2017-09-22)

### Added
- Added "software" as an uncountable word ([#21324](https://github.com/laravel/framework/pull/21324))

### Fixed
- Don't compare remember token if it's `null` ([#21328](https://github.com/laravel/framework/pull/21328))


## v5.5.11 (2017-09-21)

### Fixed
- Fixed bug in `EloquentUserProvider` introduced in [#21320](https://github.com/laravel/framework/pull/21320) ([#21323](https://github.com/laravel/framework/pull/21323))


## v5.5.10 (2017-09-21)

### Added
- Added `Route::respondWithRoute($name)` method ([#21299](https://github.com/laravel/framework/pull/21299), [66c5e46](https://github.com/laravel/framework/commit/66c5e462dbdb9d0c9d23114da3a3dc1b6e9fa0a1))
- Added `$strict` parameter to `TestResponse::assertJson()` ([#21301](https://github.com/laravel/framework/pull/21301))

### Changed
- Added "firmware" as an uncountable word ([#21306](https://github.com/laravel/framework/pull/21306))
- Allow `MorphTo::associate()` accept `null` ([#21318](https://github.com/laravel/framework/pull/21318))
- Changed `__()` signature to match `Translation::trans()` ([10c013c](https://github.com/laravel/framework/commit/10c013c564b7e518640e42e97d9178f9e05ec7d9))

### Fixed
- Add missing `driver` parameter to doctrine connection ([#21297](https://github.com/laravel/framework/pull/21297))

### Security
- Perform constant-time token comparison in `DatabaseUserProvider` ([#21320](https://github.com/laravel/framework/pull/21320))


## v5.5.9 (2017-09-20)

### Changed
Expand Down
8 changes: 3 additions & 5 deletions src/Illuminate/Auth/DatabaseUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ public function retrieveById($identifier)
*/
public function retrieveByToken($identifier, $token)
{
$user = $this->conn->table($this->table)
->where('id', $identifier)
->where('remember_token', $token)
->first();
$user = $this->conn->table($this->table)->find($identifier);

return $this->getGenericUser($user);
return $user && $user->remember_token && hash_equals($user->remember_token, $token)
? $this->getGenericUser($user) : null;
}

/**
Expand Down
13 changes: 9 additions & 4 deletions src/Illuminate/Auth/EloquentUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ public function retrieveByToken($identifier, $token)
{
$model = $this->createModel();

return $model->newQuery()
->where($model->getAuthIdentifierName(), $identifier)
->where($model->getRememberTokenName(), $token)
->first();
$model = $model->where($model->getAuthIdentifierName(), $identifier)->first();

if (! $model) {
return null;
}

$rememberToken = $model->getRememberToken();

return $rememberToken && hash_equals($rememberToken, $token) ? $model : null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Events/CommandFinished.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CommandFinished
*
* @var \Symfony\Component\Console\Output\OutputInterface|null
*/
protected $output;
public $output;

/**
* The command exit code.
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Events/CommandStarting.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CommandStarting
*
* @var \Symfony\Component\Console\Output\OutputInterface|null
*/
protected $output;
public $output;

/**
* Create a new event instance.
Expand Down
7 changes: 4 additions & 3 deletions src/Illuminate/Console/Scheduling/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ public function command($command, array $parameters = [])
* Add a new job callback event to the schedule.
*
* @param object|string $job
* @param string|null $queue
* @return \Illuminate\Console\Scheduling\CallbackEvent
*/
public function job($job)
public function job($job, $queue = null)
{
return $this->call(function () use ($job) {
dispatch(is_string($job) ? resolve($job) : $job);
return $this->call(function () use ($job, $queue) {
dispatch(is_string($job) ? resolve($job) : $job)->onQueue($queue);
})->name(is_string($job) ? $job : get_class($job));
}

Expand Down
10 changes: 6 additions & 4 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,13 @@ public function getDoctrineSchemaManager()
public function getDoctrineConnection()
{
if (is_null($this->doctrineConnection)) {
$data = ['pdo' => $this->getPdo(), 'dbname' => $this->getConfig('database')];
$driver = $this->getDoctrineDriver();

$this->doctrineConnection = new DoctrineConnection(
$data, $this->getDoctrineDriver()
);
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}

return $this->doctrineConnection;
Expand Down
12 changes: 12 additions & 0 deletions src/Illuminate/Database/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ public function flip()
return $this->toBase()->flip();
}

/**
* Pad collection to the specified length with a value.
*
* @param int $size
* @param mixed $value
* @return \Illuminate\Support\Collection
*/
public function pad($size, $value)
{
return $this->toBase()->pad($size, $value);
}

/**
* Get the type of the entities being queued.
*
Expand Down
21 changes: 20 additions & 1 deletion src/Illuminate/Database/Eloquent/RelationNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

class RelationNotFoundException extends RuntimeException
{
/**
* The name of the affected Eloquent model.
*
* @var string
*/
public $model;

/**
* The name of the relation.
*
* @var string
*/
public $relation;

/**
* Create a new exception instance.
*
Expand All @@ -17,6 +31,11 @@ public static function make($model, $relation)
{
$class = get_class($model);

return new static("Call to undefined relationship [{$relation}] on model [{$class}].");
$instance = new static("Call to undefined relationship [{$relation}] on model [{$class}].");

$instance->model = $model;
$instance->relation = $relation;

return $instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function toggle($ids, $touch = true)
/**
* Sync the intermediate tables with a list of IDs without detaching.
*
* @param \Illuminate\Database\Eloquent\Collection|array $ids
* @param \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array $ids
* @return array
*/
public function syncWithoutDetaching($ids)
Expand Down Expand Up @@ -511,7 +511,7 @@ protected function castKey($key)
protected function castAttributes($attributes)
{
return $this->using
? $this->newPivot()->forceFill($attributes)->getAttributes()
? $this->newPivot()->fill($attributes)->getAttributes()
: $attributes;
}
}
8 changes: 6 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/MorphTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,13 @@ protected function matchToMorphParents($type, Collection $results)
*/
public function associate($model)
{
$this->parent->setAttribute($this->foreignKey, $model->getKey());
$this->parent->setAttribute(
$this->foreignKey, $model instanceof Model ? $model->getKey() : null
);

$this->parent->setAttribute($this->morphType, $model->getMorphClass());
$this->parent->setAttribute(
$this->morphType, $model instanceof Model ? $model->getMorphClass() : null
);

return $this->parent->setRelation($this->relation, $model);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function getRelationExistenceCountQuery(Builder $query, Builder $parentQu
{
return $this->getRelationExistenceQuery(
$query, $parentQuery, new Expression('count(*)')
);
)->setBindings([], 'select');
}

/**
Expand Down Expand Up @@ -315,7 +315,7 @@ public static function morphMap(array $map = null, $merge = true)

if (is_array($map)) {
static::$morphMap = $merge && static::$morphMap
? array_merge(static::$morphMap, $map) : $map;
? $map + static::$morphMap : $map;
}

return static::$morphMap;
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MySqlGrammar extends Grammar
* @var array
*/
protected $modifiers = [
'VirtualAs', 'StoredAs', 'Unsigned', 'Charset', 'Collate', 'Nullable',
'Unsigned', 'VirtualAs', 'StoredAs', 'Charset', 'Collate', 'Nullable',
'Default', 'Increment', 'Comment', 'After', 'First',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.5.9';
const VERSION = '5.5.13';

/**
* The base path for the Laravel installation.
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Foundation/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use Illuminate\Support\Arr;
use Illuminate\Console\Command;
use League\Flysystem\MountManager;
use Illuminate\Filesystem\Filesystem;
Expand Down Expand Up @@ -126,8 +127,8 @@ protected function publishableChoices()
{
return array_merge(
['<comment>Publish files from all providers and tags listed below</comment>'],
preg_filter('/^/', '<comment>Provider: </comment>', ServiceProvider::publishableProviders()),
preg_filter('/^/', '<comment>Tag: </comment>', ServiceProvider::publishableGroups())
preg_filter('/^/', '<comment>Provider: </comment>', Arr::sort(ServiceProvider::publishableProviders())),
preg_filter('/^/', '<comment>Tag: </comment>', Arr::sort(ServiceProvider::publishableGroups()))
);
}

Expand Down
6 changes: 6 additions & 0 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ protected function whoopsHandler()

$handler->handleUnconditionally(true);

foreach (config('app.debug_blacklist', []) as $key => $secrets) {
foreach ($secrets as $secret) {
$handler->blacklist($key, $secret);
}
}

$handler->setApplicationPaths(
array_flip(Arr::except(
array_flip($files->directories(base_path())), [base_path('vendor')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public function assertAuthenticatedAs($user, $guard = null)
{
$expected = $this->app->make('auth')->guard($guard)->user();

$this->assertNotNull($expected, 'The current user is not authenticated.');

$this->assertInstanceOf(
get_class($expected), $user,
'The currently authenticated user is not who was expected'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ protected function transformHeadersToServerVars(array $headers)
*/
protected function formatServerHeaderKey($name)
{
if (! Str::startsWith($name, 'HTTP_') && $name !== 'CONTENT_TYPE') {
if (! Str::startsWith($name, 'HTTP_') && $name != 'CONTENT_TYPE' && $name != 'REMOTE_ADDR') {
return 'HTTP_'.$name;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Testing/DatabaseMigrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function runDatabaseMigrations()

$this->beforeApplicationDestroyed(function () {
$this->artisan('migrate:rollback');

RefreshDatabaseState::$migrated = false;
});
}
}
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,9 @@ function trans_choice($key, $number, array $replace = [], $locale = null)
* @param string $key
* @param array $replace
* @param string $locale
* @return \Illuminate\Contracts\Translation\Translator|string
* @return string
*/
function __($key = null, $replace = [], $locale = null)
function __($key, $replace = [], $locale = null)
{
return app('translator')->getFromJson($key, $replace, $locale);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function path()
}

/**
* Get the current encoded path info for the request.
* Get the current decoded path info for the request.
*
* @return string
*/
Expand Down
Loading

0 comments on commit 34c97ae

Please sign in to comment.