Skip to content

get_class(): Argument #1 ($object) must be of type object, string given in magento/framework/Setup/Patch/PatchApplier #37545

@speller

Description

@speller

Preconditions and environment

  • Magento version 2.4.6
  • Unknown

Steps to reproduce

Run setup:upgrade

Expected result

Succeeded

Actual result

Error:

Module 'Wyomind_Framework':
Module 'Wyomind_CronScheduler':
There is an error in /magento/vendor/magento/framework/Setup/Patch/PatchApplier.php at line: 255
get_class(): Argument #1 ($object) must be of type object, string given#0 /magento/vendor/magento/framework/Setup/Patch/PatchApplier.php(255): get_class('Wyomind\\CronSch...')
#1 /magento/setup/src/Magento/Setup/Model/Installer.php(1095): Magento\Framework\Setup\Patch\PatchApplier->applySchemaPatch('Wyomind_CronSch...')
#2 /magento/setup/src/Magento/Setup/Model/Installer.php(898): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\Setup), 'schema', Array)
#3 /magento/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(146): Magento\Setup\Model\Installer->installSchema(Array)
#4 /magento/vendor/symfony/console/Command/Command.php(298): Magento\Setup\Console\Command\UpgradeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /magento/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /magento/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\UpgradeCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /magento/vendor/magento/framework/Console/Cli.php(118): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /magento/vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))╷

If we look at the code, we will see the error in it:

image

The $schemaPatch variable is changing its type from string to an object. But if an exception occurred before it becomes an object (i.e. in isSkipableBySchemaSetupVersion or fixPatch methods) the string value will be passed to the get_class function and cause the error.

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: Framework/SetupUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.6Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions