Browse Source

Merge remote-tracking branch 'origin/2.6' into 3.0

Conflicts:
	app/webroot/test.php
	lib/Cake/Cache/Engine/MemcacheEngine.php
	lib/Cake/Console/Command/ConsoleShell.php
	lib/Cake/Controller/Component/AclComponent.php
	lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
	lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php
	lib/Cake/Controller/Component/AuthComponent.php
	lib/Cake/Controller/Component/EmailComponent.php
	lib/Cake/Controller/Component/SecurityComponent.php
	lib/Cake/Controller/Controller.php
	lib/Cake/Controller/Scaffold.php
	lib/Cake/Core/App.php
	lib/Cake/Model/BehaviorCollection.php
	lib/Cake/Model/Datasource/CakeSession.php
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Model/Model.php
	lib/Cake/Network/Http/HttpResponse.php
	lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
	lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
	lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
	lib/Cake/Test/Case/Model/models.php
	lib/Cake/Utility/ObjectCollection.php
	lib/Cake/Utility/Sanitize.php
	lib/Cake/Utility/Security.php
	lib/Cake/Utility/Set.php
	lib/Cake/View/Helper.php
	lib/Cake/View/Helper/PaginatorHelper.php
	lib/Cake/View/MediaView.php
	lib/Cake/View/ScaffoldView.php
	lib/Cake/basics.php
	src/Console/ConsoleOutput.php
	src/Controller/Component/RequestHandlerComponent.php
	src/Log/Engine/ConsoleLog.php
	src/Network/Request.php
	src/Template/Bake/default/classes/component.ctp
	src/TestSuite/TestCase.php
	src/View/View.php
	src/View/ViewBlock.php
mark_story 11 years ago
parent
commit
264ac857fb

+ 5 - 2
src/Console/ConsoleOutput.php

@@ -159,8 +159,11 @@ class ConsoleOutput {
 	public function __construct($stream = 'php://stdout') {
 		$this->_output = fopen($stream, 'w');
 
-		if (DS === '\\' && !(bool)env('ANSICON')) {
-			$this->_outputAs = static::PLAIN;
+		if (
+			(DS === '\\' && !(bool)env('ANSICON')) ||
+			(function_exists('posix_isatty') && !posix_isatty($this->_output))
+		) {
+			$this->_outputAs = self::PLAIN;
 		}
 	}
 

+ 2 - 2
src/Error/Debugger.php

@@ -200,7 +200,7 @@ class Debugger {
  * @param int $line Line that triggered the error
  * @param array $context Context
  * @return bool true if error was handled
- * @deprecated Will be removed in 3.0. This function is superseded by Debugger::outputError().
+ * @deprecated 3.0.0 Will be removed in 3.0. This function is superseded by Debugger::outputError().
  */
 	public static function showError($code, $description, $file = null, $line = null, $context = null) {
 		$self = Debugger::getInstance();
@@ -704,7 +704,7 @@ class Debugger {
  *    straight HTML output, or 'txt' for unformatted text.
  * @param array $strings Template strings to be used for the output format.
  * @return string
- * @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed
+ * @deprecated 3.0.0 Use Debugger::outputAs() and Debugger::addFormat(). Will be removed
  *   in 3.0
  */
 	public static function output($format = null, $strings = array()) {

+ 4 - 1
src/Log/Engine/ConsoleLog.php

@@ -56,7 +56,10 @@ class ConsoleLog extends BaseLog {
  * @throws \InvalidArgumentException
  */
 	public function __construct(array $config = array()) {
-		if (DS === '\\' && !(bool)env('ANSICON')) {
+		if (
+			(DS === '\\' && !(bool)env('ANSICON')) ||
+			(function_exists('posix_isatty') && !posix_isatty($this->_output))
+		) {
 			$this->_defaultConfig['outputAs'] = ConsoleOutput::PLAIN;
 		} else {
 			$this->_defaultConfig['outputAs'] = ConsoleOutput::COLOR;

+ 1 - 1
src/TestSuite/TestCase.php

@@ -489,8 +489,8 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
  * @param float $expected
  * @param float $margin the rage of acceptation
  * @param string $message the text to display if the assertion is not correct
+ * @deprecated 3.0.0 This is a compatiblity wrapper for 1.x. It will be removed in 3.0
  * @return void
- * @deprecated 3.0. Use assertWithinRange() instead.
  */
 	protected static function assertWithinMargin($result, $expected, $margin, $message = '') {
 		static::assertWithinRange($expected, $result, $margin, $message);