Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jakubvojacek opened this issue Feb 11, 2019 · 3 comments
Closed

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

jakubvojacek opened this issue Feb 11, 2019 · 3 comments
Assignees
Labels

Comments

@jakubvojacek
Copy link

@jakubvojacek jakubvojacek commented Feb 11, 2019

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

@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented Feb 11, 2019

Yikes, that doesn't sound good. Will have a look at it as soon as I'm at home.

Loading

@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented Feb 12, 2019

Should be fixed in dev-master I will release a new version tomorrow.
A possible cause could be that you don't provide the backup name property in your json configuration.

"backups": [
  {
    "name": "my-name"
    "source": {
    }
  }
]

Loading

@jakubvojacek
Copy link
Author

@jakubvojacek jakubvojacek commented Feb 12, 2019

yes, seems like thats the cause, I am not having the name parameter at all in my configuration. will change that.

Thank you for your quick fix 👍

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants