feature #22758 Remove HHVM support (fabpot)

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
-------

2125437c09 [WebServerBundle] removed obsolete ServerCommand abstract class
ad1f35fc72 removed HHVM support
This commit is contained in:
Fabien Potencier 2017-06-01 15:36:12 -07:00
commit 2b257d7c94
43 changed files with 69 additions and 350 deletions

View File

@ -62,17 +62,12 @@ 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
@ -80,7 +75,7 @@ before_install:
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
@ -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 () {
@ -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

View File

@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebServerBundle\Command;
use Symfony\Component\Console\Command\Command;
/**
* Base methods for commands related to a local web server.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*
* @internal
*/
abstract class ServerCommand extends Command
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
return !defined('HHVM_VERSION') && parent::isEnabled();
}
}

View File

@ -13,6 +13,7 @@ namespace Symfony\Bundle\WebServerBundle\Command;
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;
@ -26,7 +27,7 @@ use Symfony\Component\Process\Process;
*
* @author Michał Pipa <michal.pipa.xsolve@gmail.com>
*/
class ServerRunCommand extends ServerCommand
class ServerRunCommand extends Command
{
private $documentRoot;
private $environment;

View File

@ -13,6 +13,7 @@ namespace Symfony\Bundle\WebServerBundle\Command;
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;
@ -25,7 +26,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStartCommand extends ServerCommand
class ServerStartCommand extends Command
{
private $documentRoot;
private $environment;

View File

@ -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;
@ -24,7 +25,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStatusCommand extends ServerCommand
class ServerStatusCommand extends Command
{
/**
* {@inheritdoc}

View File

@ -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;
@ -23,7 +24,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class ServerStopCommand extends ServerCommand
class ServerStopCommand extends Command
{
/**
* {@inheritdoc}

View File

@ -63,7 +63,7 @@ class PhpArrayAdapter implements AdapterInterface
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);
}

View File

@ -46,7 +46,7 @@ class PhpArrayCache implements CacheInterface
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);
}

View File

@ -15,15 +15,6 @@ use Cache\IntegrationTests\CachePoolTest;
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__])) {

View File

@ -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": [

View File

@ -133,49 +133,14 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
}
}
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);
}
}

View File

@ -667,10 +667,6 @@ class Application
$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) {

View File

@ -66,9 +66,6 @@ class DebugClassLoaderTest extends TestCase
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();

View File

@ -489,38 +489,4 @@ class ErrorHandlerTest extends TestCase
$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();
}
}
}

View File

@ -233,7 +233,7 @@ class FlattenExceptionTest extends TestCase
$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++];

View File

@ -26,7 +26,7 @@ class UndefinedFunctionFatalErrorHandlerTest extends TestCase
$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());

View File

@ -105,7 +105,7 @@ abstract class FileLoader extends BaseFileLoader
$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) {

View File

@ -52,12 +52,8 @@ class FactoryReturnTypePassTest extends TestCase
/**
* @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');
@ -73,7 +69,7 @@ class FactoryReturnTypePassTest extends TestCase
{
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),

View File

@ -21,7 +21,6 @@ class FactoryDummy extends FactoryParent
{
}
// Not supported by hhvm
public function createBuiltin(): int
{
}

View File

@ -49,10 +49,6 @@ class IniFileLoaderTest extends TestCase
*/
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));
}

View File

@ -247,7 +247,7 @@ class Filesystem
$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 {

View File

@ -449,10 +449,6 @@ class FilesystemTest extends FilesystemTestCase
{
$this->markAsSkippedIfChmodIsMissing();
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('chmod() changes permissions even when passing invalid modes on HHVM');
}
$dir = $this->workspace.DIRECTORY_SEPARATOR.'file';
touch($dir);
@ -1426,10 +1422,6 @@ class FilesystemTest extends FilesystemTestCase
public function testDumpFileWithFileScheme()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM does not handle the file:// scheme correctly');
}
$scheme = 'file://';
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
@ -1476,10 +1468,6 @@ class FilesystemTest extends FilesystemTestCase
public function testAppendToFileWithScheme()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM does not handle the file:// scheme correctly');
}
$scheme = 'file://';
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
$this->filesystem->dumpFile($filename, 'foo');

View File

@ -132,11 +132,6 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
return $this->rewindable;
}
// workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed
if ('' === $this->getPath()) {
return $this->rewindable = false;
}
if (false !== $stream = @opendir($this->getPath())) {
$infos = stream_get_meta_data($stream);
closedir($stream);

View File

@ -139,23 +139,16 @@ class JsonResponse extends Response
*/
public function setData($data = array())
{
if (defined('HHVM_VERSION')) {
// HHVM does not trigger any warnings and let exceptions
// thrown from a JsonSerializable object pass through.
// If only PHP did the same...
try {
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable
// objects in a new exception that needs to be removed.
// Fortunately, PHP 5.5 and up do not trigger any warning anymore.
$data = json_encode($data, $this->encodingOptions);
} else {
try {
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable
// objects in a new exception that needs to be removed.
// Fortunately, PHP 5.5 and up do not trigger any warning anymore.
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
throw $e;
} catch (\Exception $e) {
if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
throw $e;
}
if (JSON_ERROR_NONE !== json_last_error()) {

View File

@ -1258,8 +1258,7 @@ class Response
{
$status = ob_get_status(true);
$level = count($status);
// PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3
$flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
$flags = PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE);
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
if ($flush) {

View File

@ -31,10 +31,6 @@ class MemcacheSessionHandlerTest extends TestCase
protected function setUp()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
}
parent::setUp();
$this->memcache = $this->getMockBuilder('Memcache')->getMock();
$this->storage = new MemcacheSessionHandler(

View File

@ -32,10 +32,6 @@ class MemcachedSessionHandlerTest extends TestCase
protected function setUp()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
}
parent::setUp();
if (version_compare(phpversion('memcached'), '2.2.0', '>=') && version_compare(phpversion('memcached'), '3.0.0b1', '<')) {

View File

@ -136,10 +136,6 @@ class PdoSessionHandlerTest extends TestCase
public function testReadConvertsStreamToString()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
}
$pdo = new MockPdo('pgsql');
$pdo->prepareResult = $this->getMockBuilder('PDOStatement')->getMock();
@ -157,10 +153,6 @@ class PdoSessionHandlerTest extends TestCase
public function testReadLockedConvertsStreamToString()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
}
$pdo = new MockPdo('pgsql');
$selectStmt = $this->getMockBuilder('PDOStatement')->getMock();
$insertStmt = $this->getMockBuilder('PDOStatement')->getMock();

View File

@ -51,10 +51,6 @@ class IntlBundleReaderTest extends TestCase
public function testReadDoesNotFollowFallback()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
}
// "ro_MD" -> "ro"
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'ro_MD');
@ -67,10 +63,6 @@ class IntlBundleReaderTest extends TestCase
public function testReadDoesNotFollowFallbackAlias()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
}
// "mo" = "ro_MD" -> "ro"
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'mo');

View File

@ -326,7 +326,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
public function formatTimezoneProvider()
{
$cases = array(
return array(
array('z', 'GMT', 'GMT'),
array('zz', 'GMT', 'GMT'),
array('zzz', 'GMT', 'GMT'),
@ -365,20 +365,13 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
array('zzzzz', 'Etc/Zulu', 'Coordinated Universal Time'),
array('zzzzz', 'Etc/UCT', 'Coordinated Universal Time'),
array('zzzzz', 'Etc/Greenwich', 'Greenwich Mean Time'),
array('z', 'GMT+03:00', 'GMT+3'),
array('zz', 'GMT+03:00', 'GMT+3'),
array('zzz', 'GMT+03:00', 'GMT+3'),
array('zzzz', 'GMT+03:00', 'GMT+03:00'),
array('zzzzz', 'GMT+03:00', 'GMT+03:00'),
);
if (!defined('HHVM_VERSION')) {
// these timezones are not considered valid in HHVM
$cases = array_merge($cases, array(
array('z', 'GMT+03:00', 'GMT+3'),
array('zz', 'GMT+03:00', 'GMT+3'),
array('zzz', 'GMT+03:00', 'GMT+3'),
array('zzzz', 'GMT+03:00', 'GMT+03:00'),
array('zzzzz', 'GMT+03:00', 'GMT+03:00'),
));
}
return $cases;
}
public function testFormatWithGmtTimezone()
@ -428,10 +421,6 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
public function testFormatWithDateTimeZoneGmtOffset()
{
if (defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('See https://github.com/facebook/hhvm/issues/5875');
}
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('GMT+03:00'), IntlDateFormatter::GREGORIAN, 'zzzz');
$this->assertEquals('GMT+03:00', $formatter->format(0));

View File

@ -42,7 +42,7 @@ class IntlTestHelper
// * the intl extension is loaded with version Intl::getIcuStubVersion()
// * the intl extension is not loaded
if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '<', 1)) {
if ($minimumIcuVersion && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '<', 1)) {
$testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.');
}

View File

@ -38,11 +38,6 @@ class PhpExecutableFinder
$args = $this->findArguments();
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
// HHVM support
if (defined('HHVM_VERSION')) {
return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
}
// PHP_BINARY return the current sapi executable
if (PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
return PHP_BINARY.$args;
@ -78,10 +73,7 @@ class PhpExecutableFinder
public function findArguments()
{
$arguments = array();
if (defined('HHVM_VERSION')) {
$arguments[] = '--php';
} elseif ('phpdbg' === PHP_SAPI) {
if ('phpdbg' === PHP_SAPI) {
$arguments[] = '-qrr';
}

View File

@ -1449,7 +1449,7 @@ class Process implements \IteratorAggregate
return self::$sigchild;
}
if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
if (!function_exists('phpinfo')) {
return self::$sigchild = false;
}

View File

@ -91,7 +91,7 @@ class ExecutableFinderTest extends TestCase
$this->markTestSkipped('Cannot test when open_basedir is set');
}
$this->iniSet('open_basedir', dirname(PHP_BINARY).(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
$this->iniSet('open_basedir', dirname(PHP_BINARY).PATH_SEPARATOR.'/');
$finder = new ExecutableFinder();
$result = $finder->find($this->getPhpBinaryName());
@ -109,7 +109,7 @@ class ExecutableFinderTest extends TestCase
}
$this->setPath('');
$this->iniSet('open_basedir', PHP_BINARY.(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
$this->iniSet('open_basedir', PHP_BINARY.PATH_SEPARATOR.'/');
$finder = new ExecutableFinder();
$result = $finder->find($this->getPhpBinaryName(), false);

View File

@ -24,10 +24,6 @@ class PhpExecutableFinderTest extends TestCase
*/
public function testFind()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Should not be executed in HHVM context.');
}
$f = new PhpExecutableFinder();
$current = PHP_BINARY;
@ -37,23 +33,6 @@ class PhpExecutableFinderTest extends TestCase
$this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
}
/**
* tests find() with the env var / constant PHP_BINARY with HHVM.
*/
public function testFindWithHHVM()
{
if (!defined('HHVM_VERSION')) {
$this->markTestSkipped('Should be executed in HHVM context.');
}
$f = new PhpExecutableFinder();
$current = getenv('PHP_BINARY') ?: PHP_BINARY;
$this->assertEquals($current.' --php', $f->find(), '::find() returns the executable PHP');
$this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
}
/**
* tests find() with the env var PHP_PATH.
*/
@ -61,9 +40,7 @@ class PhpExecutableFinderTest extends TestCase
{
$f = new PhpExecutableFinder();
if (defined('HHVM_VERSION')) {
$this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments');
} elseif ('phpdbg' === PHP_SAPI) {
if ('phpdbg' === PHP_SAPI) {
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
} else {
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');

View File

@ -86,10 +86,6 @@ class PhpGeneratorDumperTest extends TestCase
public function testDumpWithTooManyRoutes()
{
if (defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('HHVM consumes too much memory on this test.');
}
$this->routeCollection->add('Test', new Route('/testing/{foo}'));
for ($i = 0; $i < 32769; ++$i) {
$this->routeCollection->add('route_'.$i, new Route('/route_'.$i));

File diff suppressed because one or more lines are too long

View File

@ -30,15 +30,6 @@ class RedisCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
if (defined('HHVM_VERSION_ID')) {
if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) {
$ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
$a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
}
return $a;
}
if (!$connected = $c->isConnected()) {
return $a + array(
$prefix.'isConnected' => $connected,

View File

@ -36,7 +36,6 @@ class ReflectionCaster
$prefix = Caster::PREFIX_VIRTUAL;
$c = new \ReflectionFunction($c);
$stub->class = 'Closure'; // HHVM generates unique class names for closures
$a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);
if (isset($a[$prefix.'parameters'])) {
@ -213,9 +212,6 @@ class ReflectionCaster
self::addExtra($a, $c);
}
// Added by HHVM
unset($a[Caster::PREFIX_DYNAMIC.'static']);
return $a;
}
@ -230,9 +226,6 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
// Added by HHVM
unset($a['info']);
self::addMap($a, $c, array(
'position' => 'getPosition',
'isVariadic' => 'isVariadic',

View File

@ -282,23 +282,19 @@ class VarCloner extends AbstractCloner
self::$hashOffset = 16 - PHP_INT_SIZE;
self::$hashMask = -1;
if (defined('HHVM_VERSION')) {
self::$hashOffset += 16;
} else {
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
$frame['line'] = 0;
break;
}
}
if (!empty($frame['line'])) {
ob_start();
debug_zval_dump($obj);
self::$hashMask = (int) substr(ob_get_clean(), 17);
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
$frame['line'] = 0;
break;
}
}
if (!empty($frame['line'])) {
ob_start();
debug_zval_dump($obj);
self::$hashMask = (int) substr(ob_get_clean(), 17);
}
self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, PHP_INT_SIZE));
}

View File

@ -26,20 +26,11 @@ class RedisCasterTest extends TestCase
{
$redis = new \Redis();
if (defined('HHVM_VERSION_ID')) {
$xCast = <<<'EODUMP'
Redis {
#host: ""
%A
}
EODUMP;
} else {
$xCast = <<<'EODUMP'
$xCast = <<<'EODUMP'
Redis {
isConnected: false
}
EODUMP;
}
$this->assertDumpMatchesFormat($xCast, $redis);
}
@ -52,15 +43,7 @@ EODUMP;
self::markTestSkipped($e['message']);
}
if (defined('HHVM_VERSION_ID')) {
$xCast = <<<'EODUMP'
Redis {
#host: "127.0.0.1"
%A
}
EODUMP;
} else {
$xCast = <<<'EODUMP'
$xCast = <<<'EODUMP'
Redis {
+"socket": Redis Socket Buffer resource
isConnected: true
@ -78,7 +61,6 @@ Redis {
}
}
EODUMP;
}
$this->assertDumpMatchesFormat($xCast, $redis);
}

View File

@ -46,7 +46,6 @@ class CliDumperTest extends TestCase
$intMax = PHP_INT_MAX;
$res = (int) $var['res'];
$r = defined('HHVM_VERSION') ? '' : '#%d';
$this->assertStringMatchesFormat(
<<<EOTXT
array:24 [
@ -74,9 +73,9 @@ array:24 [
+foo: "foo"
+"bar": "bar"
}
"closure" => Closure {{$r}
"closure" => Closure {#%d
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {{$r} }
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {#%d …}
parameters: {
\$a: {}
&\$b: {
@ -231,10 +230,6 @@ EOTXT
public function testClosedResource()
{
if (defined('HHVM_VERSION') && HHVM_VERSION_ID < 30600) {
$this->markTestSkipped();
}
$var = fopen(__FILE__, 'r');
fclose($var);
@ -325,11 +320,10 @@ EOTXT
$dumper->dump($data, $out);
$out = stream_get_contents($out, -1, 0);
$r = defined('HHVM_VERSION') ? '' : '#%d';
$this->assertStringMatchesFormat(
<<<EOTXT
stream resource {@{$ref}
: Symfony\Component\VarDumper\Exception\ThrowingCasterException {{$r}
: Symfony\Component\VarDumper\Exception\ThrowingCasterException {#%d
#message: "Unexpected Exception thrown from a caster: Foobar"
trace: {
%sTwig.php:2: {
@ -384,10 +378,9 @@ EOTXT
$data = $cloner->cloneVar($var);
$out = $dumper->dump($data, true);
$r = defined('HHVM_VERSION') ? '' : '#%d';
$this->assertStringMatchesFormat(
<<<EOTXT
{{$r}
{#%d
+"foo": &1 "foo"
+"bar": &1 "foo"
}

View File

@ -47,7 +47,6 @@ class HtmlDumperTest extends TestCase
$dumpId = $dumpId[0];
$res = (int) $var['res'];
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
$this->assertStringMatchesFormat(
<<<EOTXT
<foo></foo><bar><span class=sf-dump-note>array:24</span> [<samp>
@ -75,10 +74,10 @@ class HtmlDumperTest extends TestCase
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
</samp>}
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {{$r}<samp>
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {<a class=sf-dump-ref>#%d</a><samp>
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
55 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Dumper</span><span class=sf-dump-ellipsis>\</span>HtmlDumperTest</span>"
<span class=sf-dump-meta>this</span>: <abbr title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" class=sf-dump-note>HtmlDumperTest</abbr> {{$r} &%s;}
<span class=sf-dump-meta>this</span>: <abbr title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" class=sf-dump-note>HtmlDumperTest</abbr> {<a class=sf-dump-ref>#%d</a> &%s;}
<span class=sf-dump-meta>parameters</span>: {<samp>
<span class=sf-dump-meta>\$a</span>: {}
<span class=sf-dump-meta>&amp;\$b</span>: {<samp>