From 0b44662087a6cbf0838fccc30d4453c7329e953d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 15 Apr 2016 14:57:07 +0100 Subject: [PATCH] Disable static autoloader on HHVM, fixes #5192 --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- .../Autoload/Fixtures/autoload_real_files_by_dependency.php | 2 +- .../Composer/Test/Autoload/Fixtures/autoload_real_functions.php | 2 +- .../Fixtures/autoload_real_functions_with_include_paths.php | 2 +- ...l_functions_with_removed_include_paths_and_autolad_files.php | 2 +- .../Test/Autoload/Fixtures/autoload_real_include_path.php | 2 +- .../Test/Autoload/Fixtures/autoload_real_target_dir.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 5664c93a0..ffed63c2f 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -580,7 +580,7 @@ INCLUDE_PATH; } $file .= <<= $staticPhpVersion) { + if (PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php index ead6d15bd..f9e816205 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php @@ -23,7 +23,7 @@ class ComposerAutoloaderInitFilesAutoloadOrder self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader')); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::getInitializer($loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php index a8896bbcf..c3f7482a3 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php @@ -23,7 +23,7 @@ class ComposerAutoloaderInitFilesAutoload self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_include_paths.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_include_paths.php index 220f7ae3d..b223cbb54 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_include_paths.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_include_paths.php @@ -27,7 +27,7 @@ class ComposerAutoloaderInitFilesAutoload array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php index c983006a3..6543b9222 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php @@ -23,7 +23,7 @@ class ComposerAutoloaderInitFilesAutoload self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_include_path.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_include_path.php index fbcc81426..a575fa28d 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_include_path.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_include_path.php @@ -23,7 +23,7 @@ class ComposerAutoloaderInitIncludePath self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader')); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader)); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php index 7e0b885f7..61c4ba6ad 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php @@ -23,7 +23,7 @@ class ComposerAutoloaderInitTargetDir self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader')); - if (PHP_VERSION_ID >= 50600) { + if (PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION')) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));