Skip to content

Commit 8235c7f

Browse files
committed
fix(upgrade): guard mainfile template reads
Handle unreadable mainfile.dist.php explicitly in Upgrade_230::write_mainfile() so the upgrader fails cleanly instead of falling through into noisier warnings.
1 parent 1f6f508 commit 8235c7f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

upgrade/upd-2.0.18-to-2.3.0/index.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ public function write_mainfile($vars)
417417
$file = __DIR__ . '/mainfile.dist.php';
418418

419419
$lines = file($file);
420+
if (false === $lines) {
421+
echo ERR_COULD_NOT_WRITE_MAINFILE;
422+
423+
return false;
424+
}
420425
foreach (array_keys($lines) as $ln) {
421426
if (preg_match("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", $lines[$ln], $matches)) {
422427
if (isset($vars[$matches[3]])) {

0 commit comments

Comments
 (0)