Skip to content

Commit b12f215

Browse files
minor #23216 Remove HHVM support (second edition) (Nek-)
This PR was squashed before being merged into the 4.0-dev branch (closes #23216). Discussion ---------- Remove HHVM support (second edition) | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | not needed This PR removes HHVM compatiblity following #22758 as some things were missing. It also removes some useless comments. Commits ------- 471b84c Remove HHVM support (second edition)
2 parents 0531316 + 471b84c commit b12f215

File tree

8 files changed

+11
-41
lines changed

8 files changed

+11
-41
lines changed

src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function ($key, $value, $isHit) {
6262
*/
6363
public static function create($file, CacheItemPoolInterface $fallbackPool)
6464
{
65-
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM
65+
// Shared memory is available in PHP 7.0+ with OPCache enabled
6666
if (ini_get('opcache.enable')) {
6767
if (!$fallbackPool instanceof AdapterInterface) {
6868
$fallbackPool = new ProxyAdapter($fallbackPool);

src/Symfony/Component/Cache/Simple/PhpArrayCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct($file, CacheInterface $fallbackPool)
4545
*/
4646
public static function create($file, CacheInterface $fallbackPool)
4747
{
48-
// Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM
48+
// Shared memory is available in PHP 7.0+ with OPCache enabled
4949
if (ini_get('opcache.enable')) {
5050
return new static($file, $fallbackPool);
5151
}

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,8 @@ public function handleError($type, $message, $file, $line)
382382

383383
if (4 < $numArgs = func_num_args()) {
384384
$context = $scope ? (func_get_arg(4) ?: array()) : array();
385-
$backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM
386385
} else {
387386
$context = array();
388-
$backtrace = null;
389387
}
390388

391389
if (isset($context['GLOBALS']) && $scope) {
@@ -394,15 +392,6 @@ public function handleError($type, $message, $file, $line)
394392
$context = $e;
395393
}
396394

397-
if (null !== $backtrace && $type & E_ERROR) {
398-
// E_ERROR fatal errors are triggered on HHVM when
399-
// hhvm.error_handling.call_user_handler_on_fatals=1
400-
// which is the way to get their backtrace.
401-
$this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
402-
403-
return true;
404-
}
405-
406395
$logMessage = $this->levels[$type].': '.$message;
407396

408397
if (null !== self::$toStringException) {
@@ -436,11 +425,12 @@ public function handleError($type, $message, $file, $line)
436425

437426
// Clean the trace by removing function arguments and the first frames added by the error handler itself.
438427
if ($throw || $this->tracedErrors & $type) {
439-
$backtrace = $backtrace ?: $errorAsException->getTrace();
428+
$backtrace = $errorAsException->getTrace();
440429
$lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
441430
$this->traceReflector->setValue($errorAsException, $lightTrace);
442431
} else {
443432
$this->traceReflector->setValue($errorAsException, array());
433+
$backtrace = array();
444434
}
445435
}
446436

@@ -454,32 +444,25 @@ public function handleError($type, $message, $file, $line)
454444
&& ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
455445
) {
456446
// Here, we know trigger_error() has been called from __toString().
457-
// HHVM is fine with throwing from __toString() but PHP triggers a fatal error instead.
447+
// PHP triggers a fatal error when throwing from __toString().
458448
// A small convention allows working around the limitation:
459449
// given a caught $e exception in __toString(), quitting the method with
460450
// `return trigger_error($e, E_USER_ERROR);` allows this error handler
461451
// to make $e get through the __toString() barrier.
462452

463453
foreach ($context as $e) {
464-
if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
465-
if (1 === $i) {
466-
// On HHVM
467-
$errorAsException = $e;
468-
break;
469-
}
454+
if ($e instanceof \Throwable && $e->__toString() === $message) {
470455
self::$toStringException = $e;
471456

472457
return true;
473458
}
474459
}
475460

476-
if (1 < $i) {
477-
// On PHP (not on HHVM), display the original error message instead of the default one.
478-
$this->handleException($errorAsException);
461+
// Display the original error message instead of the default one.
462+
$this->handleException($errorAsException);
479463

480-
// Stop the process by giving back the error to the native handler.
481-
return false;
482-
}
464+
// Stop the process by giving back the error to the native handler.
465+
return false;
483466
}
484467
}
485468
}

src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ private function getType(\ReflectionParameter $parameter)
5252
if (!$type = $parameter->getType()) {
5353
return;
5454
}
55-
$typeName = $type->getName();
56-
if ('array' === $typeName && !$type->isBuiltin()) {
57-
// Special case for HHVM with variadics
58-
return;
59-
}
6055

61-
return $typeName;
56+
return $type->getName();
6257
}
6358
}

src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public function read($path, $locale)
3434
// Never enable fallback. We want to know if a bundle cannot be found
3535
$bundle = new \ResourceBundle($locale, $path, false);
3636
} catch (\Exception $e) {
37-
// HHVM compatibility: constructor throws on invalid resource
3837
$bundle = null;
3938
}
4039

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,6 @@ private function extractFromMutator($class, $property)
177177
}
178178
$type = $this->extractFromReflectionType($reflectionType);
179179

180-
// HHVM reports variadics with "array" but not builtin type hints
181-
if (!$reflectionType->isBuiltin() && Type::BUILTIN_TYPE_ARRAY === $type->getBuiltinType()) {
182-
return;
183-
}
184-
185180
if (in_array($prefix, $this->arrayMutatorPrefixes)) {
186181
$type = new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type);
187182
}

src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function load($resource, $locale, $domain = 'messages')
3939
try {
4040
$rb = new \ResourceBundle($locale, $resource);
4141
} catch (\Exception $e) {
42-
// HHVM compatibility: constructor throws on invalid resource
4342
$rb = null;
4443
}
4544

src/Symfony/Component/Translation/Loader/IcuResFileLoader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function load($resource, $locale, $domain = 'messages')
3939
try {
4040
$rb = new \ResourceBundle($locale, $resource);
4141
} catch (\Exception $e) {
42-
// HHVM compatibility: constructor throws on invalid resource
4342
$rb = null;
4443
}
4544

0 commit comments

Comments
 (0)