Lỗi An exception was raised while creating “Request”; no instance returned trong Magento 2

Bài viết này mình sẽ hướng dẫn cách sửa lỗi An exception was raised while creating “Request”; no instance returned Magento 2

Lỗi An exception was raised while creating “Request”; no instance returned trong Magento 2

Trong Quá trình sử dụng và cài đặt Magento 2, có thể các bạn sẽ gặp lỗi này khi chạy 1 số lệnh như :

php bin/magento cache:flush
php bin/magento set:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f

Nguyên nhân xảy ra lỗi.

Nguyên nhân có thể là do phiên bản Magento 2 của bạn không hỗ trợ php 7.3. Cũng có thể là do kể từ PHP 7.3, cảnh báo này sẽ được đưa ra khi bạn chạy các lệnh trên. Vậy lên chúng ta sẽ có 2 cách để fix lỗi này.

Cách sửa lỗi.

Cách 1:

Các bạn kiểm tra phiên bản php hiện tại bằng lệnh php -v. Sau đó chuyển về php 7.2 bằng lệnh:

sudo update-alternatives --set php /usr/bin/php7.2

Nếu bạn không muốn chuyển về 7.2 thì có thể thử cách 2.

Cách 2:

Vào thư mục cài đặt Magento 2 và tìm file ArrayObject.php theo đường dẫn vendor\zendframework\zend-stdlib\src\ArrayObject.php.

Các bạn mở file ArrayObject.php lên tìm tới dòng thứ 426. Sửa continue; thành continue 2; rồi lưu lại.

sửa code trong ArrayObject.php

Sửa thành.

sửa code trong ArrayObject.php

Như vậy là mình đã hướng dẫn xong các bạn cách fix lỗi An exception was raised while creating “Request”; no instance returned trong Magento 2

Cảm ơn các bạn đã đọc bài viết.

4.5 2 votes
Article Rating

Callula Huy

Callula is the Marketing Executive at Magetop. With more than 5 years of copywriting under her belt, Callula is into creating valuable content that is straight to the point. Life student. Workaholic. Foreign languages and traveling aficionado.

Leave a Reply or put your Question here

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x