Skip to content

Commit

Permalink
Merge pull request #29 from Firehed/4.3.x
Browse files Browse the repository at this point in the history
Support running under `alpine` and `musl`-based environments: use `GLOB_BRACE` only when defined
  • Loading branch information
Ocramius authored Jan 21, 2021
2 parents d156180 + 651a84c commit 06358fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
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

0 comments on commit 06358fa

Please sign in to comment.