Skip to content

Commit

Permalink
Merge branch 'master' into 3.next
Browse files Browse the repository at this point in the history
Conflicts:
	VERSION.txt
  • Loading branch information
antograssiot committed Aug 20, 2016
2 parents 42ff4b2 + 905c020 commit b38262c
Show file tree
Hide file tree
Showing 26 changed files with 264 additions and 311 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -43,7 +43,6 @@ matrix:

allow_failures:
- php: hhvm
- php: 7.1

before_install:
- if [ $HHVM != 1 && $TRAVIS_PHP_VERSION != 7.* ]; then phpenv config-rm xdebug.ini; fi
Expand Down
32 changes: 0 additions & 32 deletions src/Database/Connection.php
Expand Up @@ -711,38 +711,6 @@ public function log($sql)
$this->logger()->log($query);
}

/**
* Check if cross talk is supported between two connections
*
* @param ConnectionInterface $target Connection to check cross talk with
*
* @return bool
*/
public function supportsCrossWith(ConnectionInterface $target)
{
$sourceConfig = $this->config();
$targetConfig = $target->config();

// No need to do report cross support in case the same connection is being used
if ($sourceConfig['name'] === $targetConfig['name']) {
return false;
}

$configToCheck = [
'driver',
'host',
'port'
];

foreach ($configToCheck as $config) {
if ((isset($sourceConfig[$config])) && ($sourceConfig[$config] !== $targetConfig[$config])) {
return false;
}
}

return true;
}

/**
* Returns a new statement object that will log the activity
* for the passed original statement instance.
Expand Down
129 changes: 0 additions & 129 deletions src/Database/Expression/CrossSchemaTableExpression.php

This file was deleted.

22 changes: 0 additions & 22 deletions src/Database/IdentifierQuoter.php
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\Database;

use Cake\Database\Expression\CrossSchemaTableExpression;
use Cake\Database\Expression\FieldInterface;
use Cake\Database\Expression\IdentifierExpression;
use Cake\Database\Expression\OrderByExpression;
Expand Down Expand Up @@ -93,11 +92,6 @@ public function quoteExpression($expression)
if ($expression instanceof IdentifierExpression) {
$this->_quoteIdentifierExpression($expression);

return;
}
if ($expression instanceof CrossSchemaTableExpression) {
$this->_quoteCrossSchemaTableExpression($expression);

return;
}
}
Expand Down Expand Up @@ -267,20 +261,4 @@ protected function _quoteIdentifierExpression(IdentifierExpression $expression)
$this->_driver->quoteIdentifier($expression->getIdentifier())
);
}

/**
* Quotes the cross schema table identifier
*
* @param CrossSchemaTableExpression $expression The identifier to quote
* @return void
*/
protected function _quoteCrossSchemaTableExpression(CrossSchemaTableExpression $expression)
{
if (!$expression->schema() instanceof ExpressionInterface) {
$expression->schema($this->_driver->quoteIdentifier($expression->schema()));
}
if (!$expression->table() instanceof ExpressionInterface) {
$expression->table($this->_driver->quoteIdentifier($expression->table()));
}
}
}
11 changes: 5 additions & 6 deletions src/Http/ActionDispatcher.php
Expand Up @@ -53,17 +53,16 @@ class ActionDispatcher
/**
* Constructor
*
* @param \Cake\Http\ControllerFactory $factory A controller factory instance.
* @param \Cake\Event\EventManager $eventManager An event manager if you want to inject one.
* @param \Cake\Http\ControllerFactory|null $factory A controller factory instance.
* @param \Cake\Event\EventManager|null $eventManager An event manager if you want to inject one.
* @param array $filters The list of filters to include.
*/
public function __construct($factory = null, $eventManager = null)
public function __construct($factory = null, $eventManager = null, array $filters = [])
{
if ($eventManager) {
$this->eventManager($eventManager);
}

// Compatibility with DispatcherFilters.
foreach (DispatcherFactory::filters() as $filter) {
foreach ($filters as $filter) {
$this->addFilter($filter);
}
$this->factory = $factory ?: new ControllerFactory();
Expand Down
3 changes: 2 additions & 1 deletion src/Http/BaseApplication.php
Expand Up @@ -14,6 +14,7 @@
*/
namespace Cake\Http;

use Cake\Routing\DispatcherFactory;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

Expand Down Expand Up @@ -92,6 +93,6 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res
*/
protected function getDispatcher()
{
return new ActionDispatcher();
return new ActionDispatcher(null, null, DispatcherFactory::filters());
}
}
16 changes: 14 additions & 2 deletions src/Http/ResponseTransformer.php
Expand Up @@ -162,8 +162,20 @@ public static function toPsr(CakeResponse $response)
if (!isset($headers['Content-Type'])) {
$headers['Content-Type'] = $response->type();
}
if ($response->cookie()) {
$headers['Set-Cookie'] = static::buildCookieHeader($response->cookie());
$cookies = $response->cookie();
if ($cookies) {
$sessionCookie = session_get_cookie_params();
$sessionName = session_name();
$cookies[$sessionName] = [
'name' => $sessionName,
'value' => session_id(),
'expire' => $sessionCookie['lifetime'],
'path' => $sessionCookie['path'],
'secure' => $sessionCookie['secure'],
'domain' => $sessionCookie['domain'],
'httpOnly' => $sessionCookie['httponly'],
];
$headers['Set-Cookie'] = static::buildCookieHeader($cookies);
}
$stream = static::getStream($response);

Expand Down
6 changes: 5 additions & 1 deletion src/Mailer/Email.php
Expand Up @@ -1386,9 +1386,13 @@ protected function _logDelivery($contents)
* @return \Cake\Mailer\Email Instance of Cake\Mailer\Email
* @throws \InvalidArgumentException
*/
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true)
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'default', $send = true)
{
$class = __CLASS__;

if (is_array($transportConfig)) {
$transportConfig += ['transport' => 'default'];
}
$instance = new $class($transportConfig);
if ($to !== null) {
$instance->to($to);
Expand Down
8 changes: 0 additions & 8 deletions src/ORM/Association.php
Expand Up @@ -16,7 +16,6 @@

use Cake\Collection\Collection;
use Cake\Core\ConventionsTrait;
use Cake\Database\Expression\CrossSchemaTableExpression;
use Cake\Database\Expression\IdentifierExpression;
use Cake\Datasource\EntityInterface;
use Cake\Datasource\ResultSetDecorator;
Expand Down Expand Up @@ -557,14 +556,7 @@ public function attachTo(Query $query, array $options = [])
{
$target = $this->target();
$joinType = empty($options['joinType']) ? $this->joinType() : $options['joinType'];

$table = $target->table();
if ($this->source()->connection()->supportsCrossWith($target->connection())) {
$table = new CrossSchemaTableExpression(
$target->connection()->driver()->schema(),
$table
);
}

$options += [
'includeFields' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Marshaller.php
Expand Up @@ -122,7 +122,7 @@ protected function _buildPropertyMap($data, $options)
foreach ($behaviors->loaded() as $name) {
$behavior = $behaviors->get($name);
if ($behavior instanceof PropertyMarshalInterface) {
$map = $behavior->buildMarhshalMap($this, $map, $options);
$map += $behavior->buildMarhshalMap($this, $map, $options);
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/Routing/Dispatcher.php
Expand Up @@ -58,10 +58,7 @@ class Dispatcher
*/
public function dispatch(Request $request, Response $response)
{
$actionDispatcher = new ActionDispatcher(null, $this->eventManager());
foreach ($this->_filters as $filter) {
$actionDispatcher->addFilter($filter);
}
$actionDispatcher = new ActionDispatcher(null, $this->eventManager(), $this->_filters);
$response = $actionDispatcher->dispatch($request, $response);
if (isset($request->params['return'])) {
return $response->body();
Expand Down
38 changes: 38 additions & 0 deletions src/Routing/Exception/DuplicateNamedRouteException.php
@@ -0,0 +1,38 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @since 3.3.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Routing\Exception;

use Cake\Core\Exception\Exception;

/**
* Exception raised when a route names used twice.
*/
class DuplicateNamedRouteException extends Exception
{

/**
* {@inheritDoc}
*/
protected $_messageTemplate = 'A route named "%s" has already been connected to "%s".';

/**
* {@inheritDoc}
*/
public function __construct($message, $code = 404)
{
if (is_array($message) && isset($message['message'])) {
$this->_messageTemplate = $message['message'];
}
parent::__construct($message, $code);
}
}

0 comments on commit b38262c

Please sign in to comment.