Subject: [Bug] v6.2.1 – Site backup always fails: Class "App\Services\PDO" not found (Backup.class.php line 68)
Hello,
On YetiShare v6.2.1, every automatic site backup fails (plugin upgrade with backup enabled, and the
pre-upgrade backup in general). The admin only shows "Backup failed", but the system log contains:
Uncaught Error: Class "App\Services\PDO" not found in app/services/Backup.class.php:68
#0 app/services/upgrade/SystemUpgradeService.class.php(82): App\Services\Backup->backupDatabase()
#1 app/services/upgrade/PluginUpgradeService.class.php(227): App\Services\Upgrade\SystemUpgradeService->createAndValidateBackup()
#2 app/controllers/admin/PluginController.class.php(646): App\Services\Upgrade\PluginUpgradeService->createSiteBackup()
Cause: app/services/Backup.class.php is in the namespace App\Services, and line 68 uses PDO without the
leading backslash:
} elseif (defined('PDO::MYSQL_ATTR_USE_BUFFERED_QUERY')) {
$pdoSettings[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false; // line 68
}
so PHP looks for the class App\Services\PDO. (The previous branch correctly uses \Pdo\Mysql::...)
This branch is reached on PHP versions before 8.4, where Pdo\Mysql::ATTR_USE_BUFFERED_QUERY does not exist.
Fix (one character):
$pdoSettings[\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false;
(or add "use PDO;" at the top of the file).
Steps to reproduce:
1. YetiShare v6.2.1 on PHP < 8.4 (MySQL/MariaDB).
2. Admin > Plugins > any installed plugin > Upgrade, upload a newer zip, leave "Skip site backup" off.
3. Step 2 "Backup site code and database" fails with "Backup failed"; the error above is in logs/system.
Could you please include the fix in the next release?
Thank you,
Philippe –
www.transferpro.fr