Skip to content

Commit 18ab90d

Browse files
Merge pull request #302 from Behat/maint-fix-cucumber-update
fix: Ensure assertions in the update_cucumber script are executed
2 parents 7a1a950 + a37abbf commit 18ab90d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/update.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
php-version: 8.4
2222
coverage: none
23+
ini-file: "development"
2324

2425
- name: Check whether to update or create PR
2526
id: check-existing-pr

bin/update_cucumber

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
ini_set('error_reporting', E_ALL);
1313
set_error_handler(static fn ($code, $msg, $file, $line) => throw new ErrorException($msg, $code, $code, $file, $line));
1414

15+
if (ini_get('zend.assertions') !== '1') {
16+
// Ensure our assertions are actually processed. Otherwise any code inside the assert() call is compiled out
17+
echo "This script must be run with zend.assertions set to 1\n";
18+
exit;
19+
}
20+
1521
$updater = new
1622
/**
1723
* @phpstan-type CurrentVersionArray array{tag_name: string, hash: string, composer_version: string}
@@ -264,6 +270,6 @@ try {
264270
);
265271
exit(0);
266272
} catch (Throwable $e) {
267-
echo 'ERROR: ' . $e->getMessage() . "\n";
273+
echo sprintf("ERROR [%s:%d]: %s\n", $e->getFile(), $e->getLine(), $e->getMessage());
268274
exit(1);
269275
}

0 commit comments

Comments
 (0)