Browse Source

Merge branch 'master' into 3.next

Mark Story 7 years ago
parent
commit
97cefcae99

+ 2 - 2
composer.json

@@ -95,8 +95,8 @@
             "@cs-check",
             "@test"
         ],
-        "cs-check": "phpcs --colors -p src/ tests/",
-        "cs-fix": "phpcbf --colors src/ tests/",
+        "cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
+        "cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
         "test": "phpunit",
         "test-coverage": "phpunit --coverage-clover=clover.xml"
     }

+ 1 - 1
src/Database/Expression/Comparison.php

@@ -195,7 +195,7 @@ class Comparison implements ExpressionInterface, FieldInterface
     public function __clone()
     {
         foreach (['_value', '_field'] as $prop) {
-            if ($prop instanceof ExpressionInterface) {
+            if ($this->{$prop} instanceof ExpressionInterface) {
                 $this->{$prop} = clone $this->{$prop};
             }
         }

+ 4 - 0
src/Http/ResponseEmitter.php

@@ -33,6 +33,9 @@ use Zend\Diactoros\Response\EmitterInterface;
  *
  * - It logs headers sent using CakePHP's logging tools.
  * - Cookies are emitted using setcookie() to not conflict with ext/session
+ * - For fastcgi servers with PHP-FPM session_write_close() is called just
+ *   before fastcgi_finish_request() to make sure session data is saved
+ *   correctly (especially on slower session backends).
  */
 class ResponseEmitter implements EmitterInterface
 {
@@ -63,6 +66,7 @@ class ResponseEmitter implements EmitterInterface
         }
 
         if (function_exists('fastcgi_finish_request')) {
+            session_write_close();
             fastcgi_finish_request();
         }
     }

+ 1 - 1
src/Http/ServerRequest.php

@@ -88,7 +88,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
      * The URL string used for the request.
      *
      * @var string
-     * @deprecated 3.6.0 This public property will be removed in 4.0.0. Use getRequestTarget() instead.
+     * @deprecated 3.6.0 This public property will be removed in 4.0.0. Use getPath() instead.
      */
     protected $url;
 

+ 55 - 55
src/Mailer/Mailer.php

@@ -79,85 +79,85 @@ use Cake\Mailer\Exception\MissingActionException;
  * Our mailer could either be registered in the application bootstrap, or
  * in the Table class' initialize() hook.
  *
- * @method \Cake\Mailer\Email setTo($email, $name = null)
+ * @method \Cake\Mailer\Mailer setTo($email, $name = null)
  * @method array getTo()
- * @method \Cake\Mailer\Email to($email = null, $name = null)
- * @method \Cake\Mailer\Email setFrom($email, $name = null)
+ * @method \Cake\Mailer\Mailer to($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer setFrom($email, $name = null)
  * @method array getFrom()
- * @method \Cake\Mailer\Email from($email = null, $name = null)
- * @method \Cake\Mailer\Email setSender($email, $name = null)
+ * @method \Cake\Mailer\Mailer from($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer setSender($email, $name = null)
  * @method array getSender()
- * @method \Cake\Mailer\Email sender($email = null, $name = null)
- * @method \Cake\Mailer\Email setReplyTo($email, $name = null)
+ * @method \Cake\Mailer\Mailer sender($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer setReplyTo($email, $name = null)
  * @method array getReplyTo()
- * @method \Cake\Mailer\Email replyTo($email = null, $name = null)
- * @method \Cake\Mailer\Email setReadReceipt($email, $name = null)
+ * @method \Cake\Mailer\Mailer replyTo($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer setReadReceipt($email, $name = null)
  * @method array getReadReceipt()
- * @method \Cake\Mailer\Email readReceipt($email = null, $name = null)
- * @method \Cake\Mailer\Email setReturnPath($email, $name = null)
+ * @method \Cake\Mailer\Mailer readReceipt($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer setReturnPath($email, $name = null)
  * @method array getReturnPath()
- * @method \Cake\Mailer\Email returnPath($email = null, $name = null)
- * @method \Cake\Mailer\Email addTo($email, $name = null)
- * @method \Cake\Mailer\Email setCc($email, $name = null)
+ * @method \Cake\Mailer\Mailer returnPath($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer addTo($email, $name = null)
+ * @method \Cake\Mailer\Mailer setCc($email, $name = null)
  * @method array getCc()
- * @method \Cake\Mailer\Email cc($email = null, $name = null)
- * @method \Cake\Mailer\Email addCc($email, $name = null)
- * @method \Cake\Mailer\Email setBcc($email, $name = null)
+ * @method \Cake\Mailer\Mailer cc($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer addCc($email, $name = null)
+ * @method \Cake\Mailer\Mailer setBcc($email, $name = null)
  * @method array getBcc()
- * @method \Cake\Mailer\Email bcc($email = null, $name = null)
- * @method \Cake\Mailer\Email addBcc($email, $name = null)
- * @method \Cake\Mailer\Email setCharset($charset)
+ * @method \Cake\Mailer\Mailer bcc($email = null, $name = null)
+ * @method \Cake\Mailer\Mailer addBcc($email, $name = null)
+ * @method \Cake\Mailer\Mailer setCharset($charset)
  * @method string getCharset()
- * @method \Cake\Mailer\Email charset($charset = null)
- * @method \Cake\Mailer\Email setHeaderCharset($charset)
+ * @method \Cake\Mailer\Mailer charset($charset = null)
+ * @method \Cake\Mailer\Mailer setHeaderCharset($charset)
  * @method string getHeaderCharset()
- * @method \Cake\Mailer\Email headerCharset($charset = null)
- * @method \Cake\Mailer\Email setSubject($subject)
+ * @method \Cake\Mailer\Mailer headerCharset($charset = null)
+ * @method \Cake\Mailer\Mailer setSubject($subject)
  * @method string getSubject()
- * @method \Cake\Mailer\Email subject($subject = null)
- * @method \Cake\Mailer\Email setHeaders(array $headers)
- * @method \Cake\Mailer\Email addHeaders(array $headers)
- * @method \Cake\Mailer\Email getHeaders(array $include = [])
- * @method \Cake\Mailer\Email setTemplate($template)
+ * @method \Cake\Mailer\Mailer subject($subject = null)
+ * @method \Cake\Mailer\Mailer setHeaders(array $headers)
+ * @method \Cake\Mailer\Mailer addHeaders(array $headers)
+ * @method \Cake\Mailer\Mailer getHeaders(array $include = [])
+ * @method \Cake\Mailer\Mailer setTemplate($template)
  * @method string getTemplate()
- * @method \Cake\Mailer\Email setLayout($layout)
+ * @method \Cake\Mailer\Mailer setLayout($layout)
  * @method string getLayout()
- * @method \Cake\Mailer\Email template($template = false, $layout = false)
- * @method \Cake\Mailer\Email setViewRenderer($viewClass)
+ * @method \Cake\Mailer\Mailer template($template = false, $layout = false)
+ * @method \Cake\Mailer\Mailer setViewRenderer($viewClass)
  * @method string getViewRenderer()
- * @method \Cake\Mailer\Email viewRender($viewClass = null)
- * @method \Cake\Mailer\Email setViewVars($viewVars)
+ * @method \Cake\Mailer\Mailer viewRender($viewClass = null)
+ * @method \Cake\Mailer\Mailer setViewVars($viewVars)
  * @method array getViewVars()
- * @method \Cake\Mailer\Email viewVars($viewVars = null)
- * @method \Cake\Mailer\Email setTheme($theme)
+ * @method \Cake\Mailer\Mailer viewVars($viewVars = null)
+ * @method \Cake\Mailer\Mailer setTheme($theme)
  * @method string getTheme()
- * @method \Cake\Mailer\Email theme($theme = null)
- * @method \Cake\Mailer\Email setHelpers(array $helpers)
+ * @method \Cake\Mailer\Mailer theme($theme = null)
+ * @method \Cake\Mailer\Mailer setHelpers(array $helpers)
  * @method array getHelpers()
- * @method \Cake\Mailer\Email helpers($helpers = null)
- * @method \Cake\Mailer\Email setEmailFormat($format)
+ * @method \Cake\Mailer\Mailer helpers($helpers = null)
+ * @method \Cake\Mailer\Mailer setEmailFormat($format)
  * @method string getEmailFormat()
- * @method \Cake\Mailer\Email emailFormat($format = null)
- * @method \Cake\Mailer\Email setTransport($name)
+ * @method \Cake\Mailer\Mailer emailFormat($format = null)
+ * @method \Cake\Mailer\Mailer setTransport($name)
  * @method \Cake\Mailer\AbstractTransport getTransport()
- * @method \Cake\Mailer\Email transport($name = null)
- * @method \Cake\Mailer\Email setMessageId($message)
+ * @method \Cake\Mailer\Mailer transport($name = null)
+ * @method \Cake\Mailer\Mailer setMessageId($message)
  * @method bool|string getMessageId()
- * @method \Cake\Mailer\Email messageId($message = null)
- * @method \Cake\Mailer\Email setDomain($domain)
+ * @method \Cake\Mailer\Mailer messageId($message = null)
+ * @method \Cake\Mailer\Mailer setDomain($domain)
  * @method string getDomain()
- * @method \Cake\Mailer\Email domain($domain = null)
- * @method \Cake\Mailer\Email setAttachments($attachments)
+ * @method \Cake\Mailer\Mailer domain($domain = null)
+ * @method \Cake\Mailer\Mailer setAttachments($attachments)
  * @method array getAttachments()
- * @method \Cake\Mailer\Email attachments($attachments = null)
- * @method \Cake\Mailer\Email addAttachments($attachments)
- * @method \Cake\Mailer\Email message($type = null)
- * @method \Cake\Mailer\Email setProfile($config)
+ * @method \Cake\Mailer\Mailer attachments($attachments = null)
+ * @method \Cake\Mailer\Mailer addAttachments($attachments)
+ * @method \Cake\Mailer\Mailer message($type = null)
+ * @method \Cake\Mailer\Mailer setProfile($config)
  * @method string|array getProfile()
- * @method \Cake\Mailer\Email profile($config = null)
- * @method \Cake\Mailer\Email setEmailPattern($regex)
+ * @method \Cake\Mailer\Mailer profile($config = null)
+ * @method \Cake\Mailer\Mailer setEmailPattern($regex)
  * @method string getEmailPattern()
- * @method \Cake\Mailer\Email emailPattern($regex = null)
+ * @method \Cake\Mailer\Mailer emailPattern($regex = null)
  */
 abstract class Mailer implements EventListenerInterface
 {

+ 1 - 1
src/View/ViewVarsTrait.php

@@ -38,7 +38,7 @@ trait ViewVarsTrait
      * Variables for the view
      *
      * @var array
-     * @deprecated 3.7.0 Use `$this->set()` instead.
+     * @deprecated 3.7.0 Use `$this->set()` instead, also see `$this->viewBuilder()->getVar()`.
      */
     public $viewVars = [];
 

+ 38 - 0
tests/TestCase/Database/Expression/ComparisonTest.php

@@ -0,0 +1,38 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         3.7.5
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ */
+namespace Cake\Test\TestCase\Database\Expression;
+
+use Cake\Database\Expression\Comparison;
+use Cake\Database\Expression\QueryExpression;
+use Cake\TestSuite\TestCase;
+
+/**
+ * Tests Comparison class
+ */
+class ComparisonTest extends TestCase
+{
+    /**
+     * Tests that cloning Comparion instance clones it's value and field expressions.
+     *
+     * @return void
+     */
+    public function testClone()
+    {
+        $exp = new Comparison(new QueryExpression('field1'), 1, 'integer', '<');
+        $exp2 = clone $exp;
+
+        $this->assertNotSame($exp->getField(), $exp2->getField());
+    }
+}