Skip to content

Commit

Permalink
feature #22758 Remove HHVM support (fabpot)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 4.0-dev branch (closes #22758).

Discussion
----------

Remove HHVM support

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes-ish (for HHVM users)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

2125437 [WebServerBundle] removed obsolete ServerCommand abstract class
ad1f35f removed HHVM support
  • Loading branch information
fabpot committed Jun 1, 2017
2 parents ab49685 + 2125437 commit 2b257d7
Show file tree
Hide file tree
Showing 43 changed files with 69 additions and 350 deletions.
17 changes: 4 additions & 13 deletions .travis.yml
Expand Up @@ -62,25 +62,20 @@ before_install:
export -f tfold
# php.ini configuration
if [[ $PHP = hhvm* ]]; then
INI=/etc/hhvm/php.ini
else
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
fi
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
echo date.timezone = Europe/Paris >> $INI
echo memory_limit = -1 >> $INI
echo session.gc_probability = 0 >> $INI
echo opcache.enable_cli = 1 >> $INI
echo hhvm.jit = 0 >> $INI
echo apc.enable_cli = 1 >> $INI
echo extension = ldap.so >> $INI
echo extension = redis.so >> $INI
echo extension = memcached.so >> $INI
echo extension = mongodb.so >> $INI
# Matrix lines for intermediate PHP versions are skipped for pull requests
if [[ ! $deps && ! $PHP = $MIN_PHP && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
if [[ ! $deps && ! $PHP = $MIN_PHP && $TRAVIS_PULL_REQUEST != false ]]; then
deps=skip
skip=1
else
Expand Down Expand Up @@ -145,9 +140,7 @@ install:
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
- if [[ ! $skip ]]; then ./phpunit install; fi
- |
# phpinfo
if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
- php -i

- |
run_tests () {
Expand All @@ -161,8 +154,6 @@ install:
# Test the PhpUnit bridge on PHP 5.3, using the original phpunit script
tfold src/Symfony/Bridge/PhpUnit \
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && composer update --no-progress --ansi && php phpunit-4.8.phar"
elif [[ $PHP = hhvm* ]]; then
$PHPUNIT --exclude-group benchmark,intl-data
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
Expand Down
32 changes: 0 additions & 32 deletions src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php

This file was deleted.

Expand Up @@ -13,6 +13,7 @@

use Symfony\Bundle\WebServerBundle\WebServer;
use Symfony\Bundle\WebServerBundle\WebServerConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -26,7 +27,7 @@
*
* @author Michał Pipa <michal.pipa.xsolve@gmail.com>
*/
class ServerRunCommand extends ServerCommand
class ServerRunCommand extends Command
{
private $documentRoot;
private $environment;
Expand Down
Expand Up @@ -13,6 +13,7 @@

use Symfony\Bundle\WebServerBundle\WebServer;
use Symfony\Bundle\WebServerBundle\WebServerConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -25,7 +26,7 @@
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStartCommand extends ServerCommand
class ServerStartCommand extends Command
{
private $documentRoot;
private $environment;
Expand Down
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bundle\WebServerBundle\Command;

use Symfony\Bundle\WebServerBundle\WebServer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -24,7 +25,7 @@
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStatusCommand extends ServerCommand
class ServerStatusCommand extends Command
{
/**
* {@inheritdoc}
Expand Down
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bundle\WebServerBundle\Command;

use Symfony\Bundle\WebServerBundle\WebServer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
Expand All @@ -23,7 +24,7 @@
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStopCommand extends ServerCommand
class ServerStopCommand extends Command
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
Expand Up @@ -63,7 +63,7 @@ function ($key, $value, $isHit) {
public static function create($file, CacheItemPoolInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM
if (ini_get('opcache.enable') || defined('HHVM_VERSION')) {
if (ini_get('opcache.enable')) {
if (!$fallbackPool instanceof AdapterInterface) {
$fallbackPool = new ProxyAdapter($fallbackPool);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Simple/PhpArrayCache.php
Expand Up @@ -46,7 +46,7 @@ public function __construct($file, CacheInterface $fallbackPool)
public static function create($file, CacheInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM
if (ini_get('opcache.enable') || defined('HHVM_VERSION')) {
if (ini_get('opcache.enable')) {
return new static($file, $fallbackPool);
}

Expand Down
9 changes: 0 additions & 9 deletions src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
Expand Up @@ -15,15 +15,6 @@

abstract class AdapterTestCase extends CachePoolTest
{
protected function setUp()
{
parent::setUp();

if (!array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Destructors are called late on HHVM.';
}
}

public function testDefaultLifeTime()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Component/Cache/composer.json
Expand Up @@ -34,9 +34,6 @@
"conflict": {
"symfony/var-dumper": "<3.4"
},
"suggest": {
"symfony/polyfill-apcu": "For using ApcuAdapter on HHVM"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Cache\\": "" },
"exclude-from-classmap": [
Expand Down
47 changes: 6 additions & 41 deletions src/Symfony/Component/Config/Resource/ReflectionClassResource.php
Expand Up @@ -133,49 +133,14 @@ private function generateSignature(\ReflectionClass $class)
}
}

if (defined('HHVM_VERSION')) {
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
// workaround HHVM bug with variadics, see https://github.com/facebook/hhvm/issues/5762
yield preg_replace('/^ @@.*/m', '', new ReflectionMethodHhvmWrapper($m->class, $m->name));
}
} else {
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
yield preg_replace('/^ @@.*/m', '', $m);
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
yield preg_replace('/^ @@.*/m', '', $m);

$defaults = array();
foreach ($m->getParameters() as $p) {
$defaults[$p->name] = $p->isDefaultValueAvailable() ? $p->getDefaultValue() : null;
}
yield print_r($defaults, true);
$defaults = array();
foreach ($m->getParameters() as $p) {
$defaults[$p->name] = $p->isDefaultValueAvailable() ? $p->getDefaultValue() : null;
}
yield print_r($defaults, true);
}
}
}

/**
* @internal
*/
class ReflectionMethodHhvmWrapper extends \ReflectionMethod
{
public function getParameters()
{
$params = array();

foreach (parent::getParameters() as $i => $p) {
$params[] = new ReflectionParameterHhvmWrapper(array($this->class, $this->name), $i);
}

return $params;
}
}

/**
* @internal
*/
class ReflectionParameterHhvmWrapper extends \ReflectionParameter
{
public function getDefaultValue()
{
return array($this->isVariadic(), $this->isDefaultValueAvailable() ? parent::getDefaultValue() : null);
}
}
4 changes: 0 additions & 4 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -667,10 +667,6 @@ public function renderException(\Exception $e, OutputInterface $output)
$len = Helper::strlen($title);

$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
// HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327
if (defined('HHVM_VERSION') && $width > 1 << 31) {
$width = 1 << 31;
}
$lines = array();
foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
Expand Up @@ -66,9 +66,6 @@ public function testStacking()
if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) {
$this->markTestSkipped('The ContextErrorException class is already loaded.');
}
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}

ErrorHandler::register();

Expand Down
34 changes: 0 additions & 34 deletions src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
Expand Up @@ -489,38 +489,4 @@ public function testHandleErrorException()
$this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]);
$this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage());
}

public function testHandleFatalErrorOnHHVM()
{
try {
$handler = ErrorHandler::register();

$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logger
->expects($this->once())
->method('log')
->with(
$this->equalTo(LogLevel::CRITICAL),
$this->equalTo('Fatal Error: foo')
)
;

$handler->setDefaultLogger($logger, E_ERROR);

$error = array(
'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors
'message' => 'foo',
'file' => 'bar',
'line' => 123,
'context' => array(123),
'backtrace' => array(456),
);

call_user_func_array(array($handler, 'handleError'), $error);
$handler->handleFatalError($error);
} finally {
restore_error_handler();
restore_exception_handler();
}
}
}
Expand Up @@ -233,7 +233,7 @@ function () {},
$this->assertSame(array('object', 'stdClass'), $array[$i++]);
$this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]);
$this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]);
$this->assertSame(array('resource', defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]);
$this->assertSame(array('resource', 'stream'), $array[$i++]);
$this->assertSame(array('resource', 'stream'), $array[$i++]);

$args = $array[$i++];
Expand Down
Expand Up @@ -26,7 +26,7 @@ public function testUndefinedFunction($error, $translatedMessage)
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));

$this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception);
// class names are case insensitive and PHP/HHVM do not return the same
// class names are case insensitive and PHP do not return the same
$this->assertSame(strtolower($translatedMessage), strtolower($exception->getMessage()));
$this->assertSame($error['type'], $exception->getSeverity());
$this->assertSame($error['file'], $exception->getFile());
Expand Down
Expand Up @@ -105,7 +105,7 @@ private function findClasses($namespace, $pattern, $excludePattern)

$pattern = $parameterBag->unescapeValue($parameterBag->resolveValue($pattern));
$classes = array();
$extRegexp = defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/';
$extRegexp = '/\\.php$/';
$prefixLen = null;
foreach ($this->glob($pattern, true, $resource) as $path => $info) {
if (null === $prefixLen) {
Expand Down
Expand Up @@ -52,12 +52,8 @@ public function testProcess()
/**
* @dataProvider returnTypesProvider
*/
public function testReturnTypes($factory, $returnType, $hhvmSupport = true)
public function testReturnTypes($factory, $returnType)
{
if (!$hhvmSupport && defined('HHVM_VERSION')) {
$this->markTestSkipped('Scalar typehints not supported by hhvm.');
}

$container = new ContainerBuilder();

$service = $container->register('service');
Expand All @@ -73,7 +69,7 @@ public function returnTypesProvider()
{
return array(
// must be loaded before the function as they are in the same file
array(array(FactoryDummy::class, 'createBuiltin'), null, false),
array(array(FactoryDummy::class, 'createBuiltin'), null),
array(array(FactoryDummy::class, 'createParent'), FactoryParent::class),
array(array(FactoryDummy::class, 'createSelf'), FactoryDummy::class),
array(factoryFunction::class, FactoryDummy::class),
Expand Down
Expand Up @@ -21,7 +21,6 @@ public function create(): \stdClass
{
}

// Not supported by hhvm
public function createBuiltin(): int
{
}
Expand Down
Expand Up @@ -49,10 +49,6 @@ public function testTypeConversions($key, $value, $supported)
*/
public function testTypeConversionsWithNativePhp($key, $value, $supported)
{
if (defined('HHVM_VERSION_ID')) {
return $this->markTestSkipped();
}

if (!$supported) {
$this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Filesystem/Filesystem.php
Expand Up @@ -247,7 +247,7 @@ public function chgrp($files, $group, $recursive = false)
$this->chgrp(new \FilesystemIterator($file), $group, true);
}
if (is_link($file) && function_exists('lchgrp')) {
if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
if (true !== @lchgrp($file, $group)) {
throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
}
} else {
Expand Down

0 comments on commit 2b257d7

Please sign in to comment.