Skip to content

AlertProcessor - Argument #2 ($storeId) must be of type int, string given #35602

Closed
@Nuranto

Description

@Nuranto

Preconditions and environment

  • Magento version 2.4.4
  • PHP8.1

Steps to reproduce

  • Enable product alert stock in BO (Configuration > Catalog >Product Alerts > Allow Alert When Product Comes Back in Stock > Yes, Allow Alert When Product Price Changes - Yes)
  • Reindex and cache flush
  • Front end - Login as customer - Select a Product without stock - Register to a product stock alert
    (Notify me when the price drops, Notify me when this product is in stock)
  • Add stock to that product from admin
  • Launch consumers

Expected result

Alert stock email being sent

Actual result

Emails not triggered for Product Alerts

[2022-06-10T07:31:56.520650+00:00] .CRITICAL: Magento\ProductAlert\Model\Mailing\ErrorEmailSender::execute(): Argument #2 ($storeId) must be of type int, string given, called in /var/www/html/vendor/magento/module-product-alert/Model/Mailing/AlertProcessor.php on line 130 [] []

Additional information

I guess (not tested) that change could solve the issue

Magento\Store\Model\Store

ACTUAL CODE
   /**
     * Get store identifier
     *
     * @return  int
     */
    public function getId()
    {
        return $this->_getData(self::STORE_ID);
    }


PROPOSED FIX

   /**
     * Get store identifier
     *
     * @return  int
     */
    public function getId(): int
    {
        return (int) $this->_getData(self::STORE_ID);
    }

(of course, StoreInterface interface should be modified accordingly.)

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

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions