Skip to content

phpbu\App\Adapter\Util::getAdapterReplacements() strict type #174

@jakubvojacek

Description

@jakubvojacek

Hello,

we are having issues with phpbu every since you added strict types, more precisely with file https://github.com/sebastianfeldmann/phpbu/blob/master/src/Adapter/Util.php#L24. The backup command ends up with an error

phpbu 5.1.7 by Sebastian Feldmann and contributors.

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to phpbu\App\Adapter\Util::getAdapterReplacements() must be of the type string, null given, called in /somepath/vendor/phpbu/phpbu/src/Configuration/Loader/File.php on line 170 and defined in /somepath/vendor/phpbu/phpbu/src/Adapter/Util.php:24
Stack trace:
#0 /somepath/vendor/phpbu/phpbu/src/Configuration/Loader/File.php(170): phpbu\App\Adapter\Util::getAdapterReplacements(NULL)
#1 /somepath/vendor/phpbu/phpbu/src/Configuration/Loader/Json.php(178): phpbu\App\Configuration\Loader\File->getAdapterizedValue(NULL)
#2 /somepath/vendor/phpbu/phpbu/src/Configuration/Loader/Json.php(165): phpbu\App\Configuration\Loader\Json->getBackupConfig(Array)
#3 /somepath/vendor/phpbu/phpbu/src/Configuration/Loader/File.php(74): phpbu\App\Configuration\Loader\Json->setBackups(Object(phpbu\App\Configuration))
#4 /somepath/vendor/phpbu/phpbu/src/Cmd.php(191): phpbu\App\Configuration\Loader\File->getConfiguration(Obj in /somepath/vendor/phpbu/phpbu/src/Adapter/Util.php on line 24

Changing the line I shared earlier to public static function getAdapterReplacements(?string $value) : array fixes the issue. I did not dig too deep but perhaps there is an issue in PHPBU? In what case can this value be null (we are using JSON configs)?

Thank you
Jakub

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions