Skip to content

Commit

Permalink
Closes #5662
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 14, 2024
1 parent 7852a29 commit 59b331b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
7 changes: 7 additions & 0 deletions ChangeLog-10.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes of the PHPUnit 10.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

## [10.5.7] - 2024-MM-DD

### Fixed

* [#5662](https://github.com/sebastianbergmann/phpunit/issues/5662): PHPUnit errors out on startup when the `ctype` extension is not loaded but a polyfill for it was installed

## [10.5.6] - 2024-01-13

### Added
Expand Down Expand Up @@ -79,6 +85,7 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi

* [#5563](https://github.com/sebastianbergmann/phpunit/issues/5563): `createMockForIntersectionOfInterfaces()` does not automatically register mock object for expectation verification

[10.5.7]: https://github.com/sebastianbergmann/phpunit/compare/10.5.6...10.5
[10.5.6]: https://github.com/sebastianbergmann/phpunit/compare/10.5.5...10.5.6
[10.5.5]: https://github.com/sebastianbergmann/phpunit/compare/10.5.4...10.5.5
[10.5.4]: https://github.com/sebastianbergmann/phpunit/compare/10.5.3...10.5.4
Expand Down
55 changes: 30 additions & 25 deletions phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,6 @@ if (version_compare('8.1.0', PHP_VERSION, '>')) {
die(1);
}

$requiredExtensions = ['ctype', 'dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'];

$unavailableExtensions = array_filter(
$requiredExtensions,
static function ($extension) {
return !extension_loaded($extension);
}
);

if ([] !== $unavailableExtensions) {
fwrite(
STDERR,
sprintf(
'PHPUnit requires the "%s" extensions, but the "%s" %s not available.' . PHP_EOL,
implode('", "', $requiredExtensions),
implode('", "', $unavailableExtensions),
count($unavailableExtensions) === 1 ? 'extension is' : 'extensions are'
)
);

die(1);
}

unset($requiredExtensions, $unavailableExtensions);

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
Expand Down Expand Up @@ -96,4 +71,34 @@ if (!defined('PHPUNIT_COMPOSER_INSTALL')) {

require PHPUNIT_COMPOSER_INSTALL;

$requiredExtensions = ['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'];

$unavailableExtensions = array_filter(
$requiredExtensions,
static function ($extension) {
return !extension_loaded($extension);
}
);

// Workaround for https://github.com/sebastianbergmann/phpunit/issues/5662
if (!function_exists('ctype_alnum')) {
$unavailableExtensions[] = 'ctype';
}

if ([] !== $unavailableExtensions) {
fwrite(
STDERR,
sprintf(
'PHPUnit requires the "%s" extensions, but the "%s" %s not available.' . PHP_EOL,
implode('", "', $requiredExtensions),
implode('", "', $unavailableExtensions),
count($unavailableExtensions) === 1 ? 'extension is' : 'extensions are'
)
);

die(1);
}

unset($requiredExtensions, $unavailableExtensions);

exit((new PHPUnit\TextUI\Application)->run($_SERVER['argv']));

0 comments on commit 59b331b

Please sign in to comment.