Skip to content

Commit

Permalink
set-version.php - Fix warning on PHP 8.1
Browse files Browse the repository at this point in the history
The `$sqlFile` may or may not be needed, which produces a warning:

```
Deprecated: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated in
/.../tools/bin/scripts/set-version.php on line 105
```
  • Loading branch information
totten committed Mar 11, 2023
1 parent a95742b commit 35ce6ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/bin/scripts/set-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
return "{* file to handle db changes in $newVersion during upgrade *}\n";
});
}
else {
$sqlFile = NULL;
}

updateFile("xml/version.xml", function ($content) use ($newVersion, $oldVersion) {
return str_replace($oldVersion, $newVersion, $content);
Expand Down Expand Up @@ -101,8 +104,10 @@

if ($doCommit) {
$files = array_filter(
array_merge(['xml/version.xml', 'sql/civicrm_generated.mysql', 'sql/test_data_second_domain.mysql', $phpFile, @$sqlFile], $infoXmls),
'file_exists'
array_merge(['xml/version.xml', 'sql/civicrm_generated.mysql', 'sql/test_data_second_domain.mysql', $phpFile, $sqlFile], $infoXmls),
function($file) {
return $file && file_exists($file);
}
);
$filesEsc = implode(' ', array_map('escapeshellarg', $files));
passthru("git add $filesEsc");
Expand Down

0 comments on commit 35ce6ae

Please sign in to comment.