Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dba51b4

Browse filesBrowse files
Merge branch '2.8'
* 2.8: [Process] Fix PhpProcess with phpdbg runtime Conflicts: src/Symfony/Bridge/ProxyManager/composer.json
2 parents 2abbb8a + 7748b05 commit dba51b4
Copy full SHA for dba51b4

File tree

9 files changed

+30
-26
lines changed
Filter options

9 files changed

+30
-26
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"doctrine/orm": "~2.4,>=2.4.5",
8181
"doctrine/doctrine-bundle": "~1.4",
8282
"monolog/monolog": "~1.11",
83-
"zendframework/zend-stdlib": "~2.5",
83+
"zendframework/zend-stdlib": "~2.2",
8484
"ocramius/proxy-manager": "~0.4|~1.0",
8585
"egulias/email-validator": "~1.2",
8686
"symfony/security-acl": "~2.8|~3.0",

‎phpunit

Copy file name to clipboardExpand all lines: phpunit
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2015-11-09 12:13 UTC
14+
// Cache-Id-Version: 2015-11-18 14:14 UTC
1515

1616
use Symfony\Component\Process\ProcessUtils;
1717

@@ -23,12 +23,15 @@ $PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8';
2323
$PHPUNIT_DIR = __DIR__.'/.phpunit';
2424
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
2525
$PHP = ProcessUtils::escapeArgument($PHP);
26+
if ('phpdbg' === PHP_SAPI) {
27+
$PHP .= ' -qrr';
28+
}
2629

2730
$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : `which composer.phar`))
2831
? $PHP.' '.ProcessUtils::escapeArgument($COMPOSER)
2932
: 'composer';
3033

31-
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.md5")) {
34+
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
3235
// Build a standalone phpunit without symfony/yaml
3336

3437
$oldPwd = getcwd();
@@ -49,7 +52,6 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
4952
$zip->close();
5053
chdir("phpunit-$PHPUNIT_VERSION");
5154
passthru("$COMPOSER remove --no-update symfony/yaml");
52-
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"<=3.0.0\"");
5355
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\"");
5456
passthru("$COMPOSER install --prefer-source --no-progress --ansi");
5557
file_put_contents('phpunit', <<<EOPHP
@@ -66,7 +68,7 @@ EOPHP
6668
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', str_replace('/', DIRECTORY_SEPARATOR, "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge")));
6769
symlink(realpath('../src/Symfony/Bridge/PhpUnit'), "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge");
6870
}
69-
file_put_contents('.md5', md5_file(__FILE__));
71+
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__));
7072
chdir($oldPwd);
7173

7274
}

‎src/Symfony/Bridge/ProxyManager/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.5.9",
2020
"symfony/dependency-injection": "~2.8|~3.0",
21-
"zendframework/zend-stdlib": "~2.5",
21+
"zendframework/zend-stdlib": "~2.2",
2222
"ocramius/proxy-manager": "~0.4|~1.0"
2323
},
2424
"require-dev": {

‎src/Symfony/Component/Process/PhpExecutableFinder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/PhpExecutableFinder.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function find($includeArgs = true)
4141
}
4242

4343
// PHP_BINARY return the current sapi executable
44-
if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) {
45-
return PHP_BINARY;
44+
if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
45+
return PHP_BINARY.($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
4646
}
4747

4848
if ($php = getenv('PHP_PATH')) {
@@ -76,9 +76,10 @@ public function findArguments()
7676
{
7777
$arguments = array();
7878

79-
// HHVM support
8079
if (defined('HHVM_VERSION')) {
8180
$arguments[] = '--php';
81+
} elseif ('phpdbg' === PHP_SAPI) {
82+
$arguments[] = '-qrr';
8283
}
8384

8485
return $arguments;

‎src/Symfony/Component/Process/PhpProcess.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/PhpProcess.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ public function __construct($script, $cwd = null, array $env = null, $timeout =
3939
if (false === $php = $executableFinder->find()) {
4040
$php = null;
4141
}
42+
if ('phpdbg' === PHP_SAPI) {
43+
$file = tempnam(sys_get_temp_dir(), 'dbg');
44+
file_put_contents($file, $script);
45+
register_shutdown_function('unlink', $file);
46+
$php .= ' '.ProcessUtils::escapeArgument($file);
47+
$script = null;
48+
}
4249

4350
parent::__construct($php, $cwd, $env, $script, $timeout, $options);
4451
}

‎src/Symfony/Component/Process/Process.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Process.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function start(callable $callback = null)
285285
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
286286
// Workaround for the bug, when PTS functionality is enabled.
287287
// @see : https://bugs.php.net/69442
288-
$ptsWorkaround = fopen('php://fd/0', 'r');
288+
$ptsWorkaround = fopen(__FILE__, 'r');
289289
}
290290

291291
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);

‎src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/AbstractProcessTest.php
+4-16Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
2828
public static function setUpBeforeClass()
2929
{
3030
$phpBin = new PhpExecutableFinder();
31-
self::$phpBin = $phpBin->find();
31+
self::$phpBin = 'phpdbg' === PHP_SAPI ? 'php' : $phpBin->find();
3232
}
3333

3434
public function testThatProcessDoesNotThrowWarningDuringRun()
@@ -81,7 +81,7 @@ public function testStopWithTimeoutIsActuallyWorking()
8181
// exec is mandatory here since we send a signal to the process
8282
// see https://github.com/symfony/symfony/issues/5030 about prepending
8383
// command with exec
84-
$p = $this->getProcess('exec php '.__DIR__.'/NonStopableProcess.php 3');
84+
$p = $this->getProcess('exec '.self::$phpBin.' '.__DIR__.'/NonStopableProcess.php 3');
8585
$p->start();
8686
usleep(100000);
8787
$start = microtime(true);
@@ -452,7 +452,7 @@ public function testTTYCommand()
452452
$this->markTestSkipped('Windows does have /dev/tty support');
453453
}
454454

455-
$process = $this->getProcess('echo "foo" >> /dev/null && php -r "usleep(100000);"');
455+
$process = $this->getProcess('echo "foo" >> /dev/null && '.self::$phpBin.' -r "usleep(100000);"');
456456
$process->setTty(true);
457457
$process->start();
458458
$this->assertTrue($process->isRunning());
@@ -712,7 +712,7 @@ public function testProcessThrowsExceptionWhenExternallySignaled()
712712

713713
$termSignal = defined('SIGKILL') ? SIGKILL : 9;
714714

715-
$process = $this->getProcess('exec php -r "while (true) {}"');
715+
$process = $this->getProcess('exec '.self::$phpBin.' -r "while (true) {}"');
716716
$process->start();
717717
posix_kill($process->getPid(), $termSignal);
718718

@@ -738,18 +738,6 @@ public function testRestart()
738738
$this->assertNotEquals($process1->getOutput(), $process2->getOutput());
739739
}
740740

741-
public function testPhpDeadlock()
742-
{
743-
$this->markTestSkipped('Can cause PHP to hang');
744-
745-
// Sleep doesn't work as it will allow the process to handle signals and close
746-
// file handles from the other end.
747-
$process = $this->getProcess(self::$phpBin.' -r "while (true) {}"');
748-
$process->start();
749-
750-
// PHP will deadlock when it tries to cleanup $process
751-
}
752-
753741
public function testRunProcessWithTimeout()
754742
{
755743
$timeout = 0.5;

‎src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function testFindArguments()
4444

4545
if (defined('HHVM_VERSION')) {
4646
$this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments');
47+
} elseif ('phpdbg' === PHP_SAPI) {
48+
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
4749
} else {
4850
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
4951
}

‎src/Symfony/Component/Process/Tests/PhpProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/PhpProcessTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function testNonBlockingWorks()
3030

3131
public function testCommandLine()
3232
{
33+
if ('phpdbg' === PHP_SAPI) {
34+
$this->markTestSkipped('phpdbg SAPI is not supported by this test.');
35+
}
36+
3337
$process = new PhpProcess(<<<PHP
3438
<?php echo 'foobar';
3539
PHP

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.