Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running under alpine and musl-based environments: use GLOB_BRACE only when defined #29

Merged
merged 8 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/alpine.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-cli-alpine
COPY . .
12 changes: 12 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ jobs:

- name: "Tests"
run: "vendor/bin/phpunit"

- name: "Build Alpine image"
if: ${{ matrix.operating-system == 'ubuntu-latest' }}
run: docker build
--file .github/workflows/alpine.dockerfile
--build-arg PHP_VERSION=${{ matrix.php-version }}
--tag testenv
.

- name: "Test under Alpine"
if: ${{ matrix.operating-system == 'ubuntu-latest' }}
run: docker run testenv vendor/bin/phpunit
3 changes: 2 additions & 1 deletion src/Iterator/GlobIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function __construct($glob, $flags = 0)
// glob() does not support [^...] on Windows
('\\' !== DIRECTORY_SEPARATOR || false === strpos($glob, '[^'))
) {
$results = glob($glob, GLOB_BRACE);
// GLOB_BRACE is not available in some environments.
$results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0);

// $results may be empty or false if $glob is invalid
if (empty($results)) {
Expand Down