Skip to content

Commit 13e80c4

Browse files
Merge pull request #18 from laravel/5.7
5.7
2 parents 35df766 + e2fd979 commit 13e80c4

File tree

19 files changed

+351
-29
lines changed

19 files changed

+351
-29
lines changed

.travis.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ language: php
33

44
env:
55
global:
6-
- setup=stable
6+
- SETUP=stable
77

88
matrix:
99
fast_finish: true
1010
include:
1111
- php: 7.1
1212
- php: 7.1
13-
env: setup=lowest
13+
env: SETUP=lowest
1414
- php: 7.2
1515
- php: 7.2
16-
env: setup=lowest
16+
env: SETUP=lowest
1717
- php: 7.3
1818
- php: 7.3
19-
env: setup=lowest
19+
env: SETUP=lowest
2020

2121
cache:
2222
directories:
@@ -35,7 +35,7 @@ before_install:
3535
- mysql -e 'CREATE DATABASE forge;'
3636

3737
install:
38-
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi
39-
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi
38+
- if [[ $SETUP = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi
39+
- if [[ $SETUP = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi
4040

4141
script: vendor/bin/phpunit

CHANGELOG-5.7.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Release Notes for 5.7.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v5.7.24...5.7)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v5.7.25...5.7)
4+
5+
6+
## [v5.7.25 (2019-02-05)](https://github.com/laravel/framework/compare/v5.7.24...v5.7.25)
7+
8+
### Added
9+
- Allowed specifying custom translation for date relative messages ([#27341](https://github.com/laravel/framework/pull/27341))
10+
- Add computed support to SQL Server schema grammar ([#27346](https://github.com/laravel/framework/pull/27346), [1c74d7f](https://github.com/laravel/framework/commit/1c74d7fe595df223279de55dffc7ae6fc8ac9ca6))
11+
- Allowed `ENV` to control paths of `cache files` for `services`, `packages` and `routes` ([#27389](https://github.com/laravel/framework/pull/27389))
12+
13+
### Fixed
14+
- Fixed `BelongsToMany` pivot relationship child with loaded relations wakeup ([#27358](https://github.com/laravel/framework/pull/27358))
15+
- Fixed wrong class being used when eager loading nullable `MorphTo` with `withDefault()` ([#27411](https://github.com/laravel/framework/pull/27411))
16+
17+
### Changed
18+
- Removed `php_network_getaddresses: getaddrinfo failed: Name or service not known` in `DetectsLostConnections` trait ([#27418](https://github.com/laravel/framework/pull/27418))
419

520

621
## [v5.7.24 (2019-01-30)](https://github.com/laravel/framework/compare/v5.7.23...v5.7.24)

src/Illuminate/Cache/TaggedCache.php

+10
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,14 @@ protected function event($event)
9494
{
9595
parent::event($event->setTags($this->tags->getNames()));
9696
}
97+
98+
/**
99+
* Get the tag set instance.
100+
*
101+
* @return \Illuminate\Cache\TagSet
102+
*/
103+
public function getTags()
104+
{
105+
return $this->tags;
106+
}
97107
}

src/Illuminate/Database/DetectsLostConnections.php

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ protected function causedByLostConnection(Throwable $e)
3434
'reset by peer',
3535
'Physical connection is not usable',
3636
'TCP Provider: Error code 0x68',
37-
'php_network_getaddresses: getaddrinfo failed: Name or service not known',
3837
'ORA-03114',
3938
'Packets out of order. Expected',
4039
'Adaptive Server connection failed',

src/Illuminate/Database/Eloquent/Concerns/HasEvents.php

+21
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,25 @@ public static function unsetEventDispatcher()
351351
{
352352
static::$dispatcher = null;
353353
}
354+
355+
/**
356+
* Execute a callback without firing any model events for any model type.
357+
*
358+
* @param callable $callback
359+
* @return mixed
360+
*/
361+
public static function withoutEvents(callable $callback)
362+
{
363+
$dispatcher = static::getEventDispatcher();
364+
365+
static::unsetEventDispatcher();
366+
367+
try {
368+
return $callback();
369+
} finally {
370+
if ($dispatcher) {
371+
static::setEventDispatcher($dispatcher);
372+
}
373+
}
374+
}
354375
}

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

-10
Original file line numberDiff line numberDiff line change
@@ -415,16 +415,6 @@ public function prepareBindingsForUpdate(array $bindings, array $values)
415415
);
416416
}
417417

418-
/**
419-
* Determine if the grammar supports savepoints.
420-
*
421-
* @return bool
422-
*/
423-
public function supportsSavepoints()
424-
{
425-
return true;
426-
}
427-
428418
/**
429419
* Compile the SQL statement to define a savepoint.
430420
*

src/Illuminate/Foundation/Application.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
2929
*
3030
* @var string
3131
*/
32-
const VERSION = '5.7.24';
32+
const VERSION = '5.7.25';
3333

3434
/**
3535
* The base path for the Laravel installation.
@@ -55,14 +55,14 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
5555
/**
5656
* The array of booting callbacks.
5757
*
58-
* @var array
58+
* @var callable[]
5959
*/
6060
protected $bootingCallbacks = [];
6161

6262
/**
6363
* The array of booted callbacks.
6464
*
65-
* @var array
65+
* @var callable[]
6666
*/
6767
protected $bootedCallbacks = [];
6868

@@ -823,7 +823,7 @@ protected function bootProvider(ServiceProvider $provider)
823823
/**
824824
* Register a new boot listener.
825825
*
826-
* @param mixed $callback
826+
* @param callable $callback
827827
* @return void
828828
*/
829829
public function booting($callback)
@@ -834,7 +834,7 @@ public function booting($callback)
834834
/**
835835
* Register a new "booted" listener.
836836
*
837-
* @param mixed $callback
837+
* @param callable $callback
838838
* @return void
839839
*/
840840
public function booted($callback)
@@ -849,7 +849,7 @@ public function booted($callback)
849849
/**
850850
* Call the booting callbacks for the application.
851851
*
852-
* @param array $callbacks
852+
* @param callable[] $callbacks
853853
* @return void
854854
*/
855855
protected function fireAppCallbacks(array $callbacks)
@@ -885,7 +885,7 @@ public function shouldSkipMiddleware()
885885
*/
886886
public function getCachedServicesPath()
887887
{
888-
return $this->bootstrapPath().'/cache/services.php';
888+
return $_ENV['APP_SERVICES_CACHE'] ?? $this->bootstrapPath().'/cache/services.php';
889889
}
890890

891891
/**
@@ -895,7 +895,7 @@ public function getCachedServicesPath()
895895
*/
896896
public function getCachedPackagesPath()
897897
{
898-
return $this->bootstrapPath().'/cache/packages.php';
898+
return $_ENV['APP_PACKAGES_CACHE'] ?? $this->bootstrapPath().'/cache/packages.php';
899899
}
900900

901901
/**
@@ -935,7 +935,7 @@ public function routesAreCached()
935935
*/
936936
public function getCachedRoutesPath()
937937
{
938-
return $this->bootstrapPath().'/cache/routes.php';
938+
return $_ENV['APP_ROUTES_CACHE'] ?? $this->bootstrapPath().'/cache/routes.php';
939939
}
940940

941941
/**

src/Illuminate/Http/Resources/MergeValue.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MergeValue
1717
/**
1818
* Create new merge value instance.
1919
*
20-
* @param \Illuminate\Support\Collection|array $data
20+
* @param \Illuminate\Support\Collection|\JsonSerializable|array $data
2121
* @return void
2222
*/
2323
public function __construct($data)

src/Illuminate/Pipeline/Pipeline.php

+12
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ public function then(Closure $destination)
104104
return $pipeline($this->passable);
105105
}
106106

107+
/**
108+
* Run the pipeline and return the result.
109+
*
110+
* @return mixed
111+
*/
112+
public function thenReturn()
113+
{
114+
return $this->then(function ($passable) {
115+
return $passable;
116+
});
117+
}
118+
107119
/**
108120
* Get the final piece of the Closure onion.
109121
*

src/Illuminate/Support/Collection.php

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ public function crossJoin(...$lists)
312312
/**
313313
* Dump the collection and end the script.
314314
*
315+
* @param mixed ...$args
315316
* @return void
316317
*/
317318
public function dd(...$args)

src/Illuminate/Support/Testing/Fakes/EventFake.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function dispatch($event, $payload = [], $halt = false)
211211
if ($this->shouldFakeEvent($name, $payload)) {
212212
$this->events[$name][] = func_get_args();
213213
} else {
214-
$this->dispatcher->dispatch($event, $payload, $halt);
214+
return $this->dispatcher->dispatch($event, $payload, $halt);
215215
}
216216
}
217217

tests/Database/DatabaseEloquentModelTest.php

+37
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,37 @@ public function testModelObserversCanBeAttachedToModelsThroughCallingObserveMeth
13251325
EloquentModelStub::flushEventListeners();
13261326
}
13271327

1328+
public function testWithoutEventDispatcher()
1329+
{
1330+
EloquentModelSaveStub::setEventDispatcher($events = m::mock(Dispatcher::class));
1331+
$events->shouldReceive('listen')->once()->with('eloquent.creating: Illuminate\Tests\Database\EloquentModelSaveStub', EloquentTestObserverStub::class.'@creating');
1332+
$events->shouldReceive('listen')->once()->with('eloquent.saved: Illuminate\Tests\Database\EloquentModelSaveStub', EloquentTestObserverStub::class.'@saved');
1333+
$events->shouldNotReceive('until');
1334+
$events->shouldNotReceive('dispatch');
1335+
$events->shouldReceive('forget');
1336+
EloquentModelSaveStub::observe(EloquentTestObserverStub::class);
1337+
1338+
$model = EloquentModelSaveStub::withoutEvents(function () {
1339+
$model = new EloquentModelSaveStub;
1340+
$model->save();
1341+
1342+
return $model;
1343+
});
1344+
1345+
$model->withoutEvents(function () use ($model) {
1346+
$model->first_name = 'Taylor';
1347+
$model->save();
1348+
});
1349+
1350+
$events->shouldReceive('until')->once()->with('eloquent.saving: Illuminate\Tests\Database\EloquentModelSaveStub', $model);
1351+
$events->shouldReceive('dispatch')->once()->with('eloquent.saved: Illuminate\Tests\Database\EloquentModelSaveStub', $model);
1352+
1353+
$model->last_name = 'Otwell';
1354+
$model->save();
1355+
1356+
EloquentModelSaveStub::flushEventListeners();
1357+
}
1358+
13281359
public function testSetObservableEvents()
13291360
{
13301361
$class = new EloquentModelStub;
@@ -1976,7 +2007,13 @@ class EloquentModelSaveStub extends Model
19762007

19772008
public function save(array $options = [])
19782009
{
2010+
if ($this->fireModelEvent('saving') === false) {
2011+
return false;
2012+
}
2013+
19792014
$_SERVER['__eloquent.saved'] = true;
2015+
2016+
$this->fireModelEvent('saved', false);
19802017
}
19812018

19822019
public function setIncrementing($value)

tests/Foundation/FoundationApplicationTest.php

+26
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,32 @@ public function testBeforeBootstrappingAddsClosure()
209209
$this->assertArrayHasKey(0, $app['events']->getListeners('bootstrapping: Illuminate\Foundation\Bootstrap\RegisterFacades'));
210210
}
211211

212+
public function testTerminationTests()
213+
{
214+
$app = new Application;
215+
216+
$result = [];
217+
$callback1 = function () use (&$result) {
218+
$result[] = 1;
219+
};
220+
221+
$callback2 = function () use (&$result) {
222+
$result[] = 2;
223+
};
224+
225+
$callback3 = function () use (&$result) {
226+
$result[] = 3;
227+
};
228+
229+
$app->terminating($callback1);
230+
$app->terminating($callback2);
231+
$app->terminating($callback3);
232+
233+
$app->terminate();
234+
235+
$this->assertEquals([1, 2, 3], $result);
236+
}
237+
212238
public function testAfterBootstrappingAddsClosure()
213239
{
214240
$app = new Application;

0 commit comments

Comments
 (0)