From 1dfa27c145ae1645954f5dca9eff6efc561d0f3c Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Sat, 6 Jun 2026 21:31:51 +0100 Subject: install: fix null gBitInstallDb in upgrade step Each installer step is a separate HTTP request. install_packages.php creates $gBitInstallDb but by the time install_upgrade.php runs it is a fresh request and the variable is null, causing a fatal error when upgrade_packages is submitted. Re-establish the DB connection at the start of the upgrade submission block if $gBitInstallDb is not already set. Co-Authored-By: Claude Sonnet 4.6 --- includes/install_upgrade.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/install_upgrade.php b/includes/install_upgrade.php index 2907c18..3fce5bd 100755 --- a/includes/install_upgrade.php +++ b/includes/install_upgrade.php @@ -13,6 +13,12 @@ $errors = $success = []; $gBitInstaller->loadAllUpgradeFiles(); if( !empty( $_REQUEST['upgrade_packages'] )) { + // install_packages.php creates $gBitInstallDb but that runs in a previous request. + // Re-establish the connection here for the upgrade step. + if( empty( $gBitInstallDb ) ) { + $gBitInstallDb = ADONewConnection( $gBitDbType ); + $gBitInstallDb->Connect( $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbType != 'pdo' ? $gBitDbName : null ); + } if( !empty( $gDebug ) || !empty( $_REQUEST['debug'] ) ) { $gBitInstallDb->debug = 99; } -- cgit v1.3