Skip to content

callMethodOnDumper incorrectly overrides DbDumper->skipSsl #1946

@aschkenasy

Description

@aschkenasy

when setting skip_ssl in config/database.php

            'dump' => [
                'skip_ssl' => env('BACKUP_MYSQL_SKIP_SSL', false),
            ],

the flag is always set regardless of the actual value of skip_ssl

the override of the actual passed value happens in callMethodOnDumper of https://github.com/spatie/laravel-backup/blob/main/src/Tasks/Backup/DbDumperFactory.php since

        if (! $methodValue) {
            $dbDumper->$methodName();

            return $dbDumper;
        }

calls DbDumper->setSkipSsl() which is by default set to true

    public function setSkipSsl(bool $skipSsl = true): self
    {
        $this->skipSsl = $skipSsl;

        return $this;
    }

i assume the correct implementation of this is

    protected static function callMethodOnDumper(DbDumper $dbDumper, string $methodName, mixed $methodValue): DbDumper
    {
        if (! isset($methodValue)) {
            $dbDumper->$methodName();

            return $dbDumper;
        }

        $dbDumper->$methodName($methodValue);

        return $dbDumper;
    }

i will submit a PR shortly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions