Skip to content

Commit

Permalink
Check if the pipe array is empty before calling stream_select()
Browse files Browse the repository at this point in the history
  • Loading branch information
jfposton authored and fabpot committed Nov 15, 2013
1 parent 43371bb commit 52a18ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/Process/ProcessPipes.php
Expand Up @@ -247,6 +247,10 @@ private function readFileHandles($close = false)
*/
private function readStreams($blocking, $close = false)
{
if (empty($this->pipes)) {
return array();
}

$read = array();

$r = $this->pipes;
Expand Down
10 changes: 10 additions & 0 deletions src/Symfony/Component/Process/Tests/AbstractProcessTest.php
Expand Up @@ -19,6 +19,16 @@
*/
abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
{
public function testThatProcessDoesNotThrowWarningDuringRun()
{
@trigger_error('Test Error', E_USER_NOTICE);
$process = $this->getProcess("php -r 'sleep(3)'");
$process->run();
$actualError = error_get_last();
$this->assertEquals('Test Error', $actualError['message']);
$this->assertEquals(E_USER_NOTICE, $actualError['type']);
}

/**
* @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
*/
Expand Down

0 comments on commit 52a18ea

Please sign in to comment.