Skip to content

Commit

Permalink
Add function existence check before opcache_invalidate call (#192)
Browse files Browse the repository at this point in the history
The code is updated to check for the existence of the
`opcache_invalidate` function before calling it. This change eliminates
potential errors for environments where `opcache_invalidate` might not
be available.
  • Loading branch information
SmetDenis committed May 9, 2024
1 parent 8a9fb9e commit a0a6637
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ jobs:
cd ./build/composer-test
composer init --no-interaction --name="test/test"
composer require jbzoo/csv-blueprint
./vendor/bin/csv-blueprint || true
./vendor/bin/csv-blueprint $CMD_VALIDATE $VALID_TEST || true
./vendor/bin/csv-blueprint $CMD_VALIDATE $INVALID_TEST || true
./vendor/bin/csv-blueprint
./vendor/bin/csv-blueprint validate-csv --ansi -vvv --csv="../../tests/fixtures/batch/*.csv" --schema="../../tests/schemas/demo_valid.yml"
verify-phar-binary:
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/AbstractValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function findFiles(string $option, bool $throwException = true): array
$filenames = \array_values(Utils::findFiles($patterns));

// Hackish. Clear cache for schema files because we have aggressive opcode caching.
if ($option === 'schema') {
if ($option === 'schema' && \function_exists('opcache_invalidate')) {
foreach ($filenames as $filename) {
\opcache_invalidate((string)$filename->getRealPath(), true);
}
Expand Down

0 comments on commit a0a6637

Please sign in to comment.