Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 5.4:
  Throw exception if incompatible version of psr/simple-cache is used
  [DependencyInjection] copy synthetic status when resolving child definitions
  [HttpClient] Fix Failed to open stream: Too many open files
  [Console] use STDOUT/ERR in ConsoleOutput to save opening too many file descriptors
  Fix for "Implicit conversion from float <float_number> to int loses precision"
  Fix typo in UPGRADE-6.0.md
  [Cache] Set mtime of cache files 1 year into future if they do not expire
  [DependencyInjection] remove arbitratry limitation to exclude inline services from bindings
  • Loading branch information
fabpot committed Jan 22, 2022
2 parents faf53e7 + 2693247 commit 3a3ab72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Output/ConsoleOutput.php
Expand Up @@ -149,14 +149,20 @@ private function openOutputStream()
return fopen('php://output', 'w');
}

return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
// Use STDOUT when possible to prevent from opening too many file descriptors
return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
}

/**
* @return resource
*/
private function openErrorStream()
{
return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
if (!$this->hasStderrSupport()) {
return fopen('php://output', 'w');
}

// Use STDERR when possible to prevent from opening too many file descriptors
return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
}
}

0 comments on commit 3a3ab72

Please sign in to comment.