Jump to content

Edit History

wepresta

wepresta

Hi,

This is not a configuration issue , it’s a bug in PrestaShop 9.0.2.

Your screenshot shows this error:

AddStateCommand::__construct(): Argument #1 ($countryId) must be of type int, string given

So when you save a State, the form sends country_id as a string, but the command expects an int, and the back office crashes.

The real fix :

Update PrestaShop to the latest 9.0.x patch (9.0.3 / 9.0.4+). This issue is typically fixed in a patch release.

Quick workaround (if you can’t update right now)

Patch the core to cast the country id to int in:

src/Core/Form/IdentifiableObject/DataHandler/StateFormDataHandler.php

Before creating the command, cast it:

$countryId = (int) $data['country_id'];

Then use $countryId when building AddStateCommand.

Note: this is a core change and will be overwritten by the next update, so upgrading is the clean solution.

wepresta

wepresta

Hi,

This is not a configuration issue — it’s a bug in PrestaShop 9.0.2.

Your screenshot shows this error:

AddStateCommand::__construct(): Argument #1 ($countryId) must be of type int, string given

So when you save a State, the form sends country_id as a string, but the command expects an int, and the back office crashes.

The real fix :

Update PrestaShop to the latest 9.0.x patch (9.0.3 / 9.0.4+). This issue is typically fixed in a patch release.

Quick workaround (if you can’t update right now)

Patch the core to cast the country id to int in:

src/Core/Form/IdentifiableObject/DataHandler/StateFormDataHandler.php

Before creating the command, cast it:

$countryId = (int) $data['country_id'];

Then use $countryId when building AddStateCommand.

Note: this is a core change and will be overwritten by the next update, so upgrading is the clean solution.

wepresta

wepresta

Hi,

This is not a configuration issue — it’s a bug in PrestaShop 9.0.2.

Your screenshot shows this error:

AddStateCommand::__construct(): Argument #1 ($countryId) must be of type int, string given

So when you save a State, the form sends country_id as a string, but the command expects an int, and the back office crashes.

The real fix (recommended)

Update PrestaShop to the latest 9.0.x patch (9.0.3 / 9.0.4+). This issue is typically fixed in a patch release.

Quick workaround (if you can’t update right now)

Patch the core to cast the country id to int in:

src/Core/Form/IdentifiableObject/DataHandler/StateFormDataHandler.php

Before creating the command, cast it:

$countryId = (int) $data['country_id'];

Then use $countryId when building AddStateCommand.

Note: this is a core change and will be overwritten by the next update, so upgrading is the clean solution.

×
×
  • Create New...