mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 07:09:46 +00:00
Merge pull request #5743 from cakephp/issue-4901
Fix warnings when php://output is used with ConsoleOutput.
This commit is contained in:
commit
53f52cef3c
2 changed files with 12 additions and 0 deletions
lib/Cake
|
@ -162,6 +162,7 @@ class ConsoleOutput {
|
||||||
$this->_output = fopen($stream, 'w');
|
$this->_output = fopen($stream, 'w');
|
||||||
|
|
||||||
if ((DS === '\\' && !(bool)env('ANSICON')) ||
|
if ((DS === '\\' && !(bool)env('ANSICON')) ||
|
||||||
|
$stream === 'php://output' ||
|
||||||
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
||||||
) {
|
) {
|
||||||
$this->_outputAs = self::PLAIN;
|
$this->_outputAs = self::PLAIN;
|
||||||
|
|
|
@ -231,6 +231,17 @@ class ConsoleOutputTest extends CakeTestCase {
|
||||||
$this->output->write('<error>Bad</error> Regular', false);
|
$this->output->write('<error>Bad</error> Regular', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test plain output when php://output, as php://output is
|
||||||
|
* not compatible with posix_ functions.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testOutputAsPlainWhenOutputStream() {
|
||||||
|
$output = $this->getMock('ConsoleOutput', array('_write'), array('php://output'));
|
||||||
|
$this->assertEquals(ConsoleOutput::PLAIN, $output->outputAs());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test plain output only strips tags used for formatting.
|
* test plain output only strips tags used for formatting.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue