EC-CUBE / EC-CUBE/ec-cube

eccube_max_total_feeを超える価格のものをカートに入れるとInvalidArgumentExceptionが発生する

Open
#4,498 1 comment 0 reactions 0 assignees View on GitHub
bug:Low
Dominant language
PHP
Stars
788
Forks
719
Avg merge
3d 20h
Merged PRs (30d)
45

Description

## 概要(Overview)

カートに金額が大きい商品を入れると500エラーが発生します

stacktraceは以下の内容になります

```
InvalidArgumentException:
Entity has to be managed or scheduled for removal for single computation Eccube\Entity\CartItem@00000000711c8f360000000061f5e310

at /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:516
at Doctrine\ORM\UnitOfWork->computeSingleEntityChangeSet(object(CartItem))
(/var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:344)
at Doctrine\ORM\UnitOfWork->commit(object(CartItem))
(/var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:368)
at Doctrine\ORM\EntityManager->flush(object(CartItem))
(/var/www/html/var/cache/dev/ContainerRlle57r/EntityManager_9a5be93.php:170)
at EntityManager_9a5be93->flush(object(CartItem))
(Eccube/Service/CartService.php:284)
at Eccube\Service\CartService->restoreCarts(array())
(Eccube/Service/CartService.php:390)
at Eccube\Service\CartService->removeProduct(object(ProductClass))
(/var/www/html/var/cache/dev/ContainerRlle57r/CartService_9dde17f.php:90)
at CartService_9dde17f->removeProduct(11)
(Eccube/Controller/ProductController.php:423)
at Eccube\Controller\ProductController->addCart(object(Request), object(Product))
(/var/www/html/vendor/symfony/http-kernel/HttpKernel.php:151)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(/var/www/html/vendor/symfony/http-kernel/HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(/var/www/html/vendor/symfony/http-kernel/Kernel.php:200)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(/var/www/html/index.php:76)
```

## 期待する内容(Expect) or 要望 (Requirement)

500エラーが起きないよう対応する

## 再現手順(Procedure)

[こちら](https://github.com/EC-CUBE/ec-cube/blob/4.0/app/config/eccube/packages/eccube.yaml#L54)の設定値以上の値段になるよう商品(または商品個数)をカートに入れる

### 環境 (environment)

+ EC-CUBE: 4.0.1
+ PHP: 7.3.x
+ DB:
- MySQL 5.7.x

## 関連情報 (Ref)

Contributor guide

Open the contributing guide

Research direction

Start with the limit configured in app/config/eccube/packages/eccube.yaml and trace the reported flow through Eccube/Service/CartService.php, especially restoreCarts and removeProduct, then Eccube/Controller/ProductController.php addCart. Reproduce with a cart total above the configured value and verify the request no longer returns a 500 error or the reported InvalidArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php, symfony
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.