Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SC_Helper_Purchase:: getOrderTemp()の返り値を必ずarrayに #1070

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clicktx
Copy link
Contributor

@clicktx clicktx commented Nov 28, 2024

data/class/helper/SC_Helper_Purchase.php

2024/11/xx 13:04:38 [/shopping/confirm.php] Warning(E_WARNING): array_merge(): Expected parameter 1 to be an array, null given on [/path/data/class/pages/shopping/LC_Page_Shopping_Confirm.php(145)] from xxx.xxx.xxx.xxx

// 一時受注テーブルの読込
$arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
// カート集計を元に最終計算
$arrCalcResults = $objCartSess->calculate($this->cartKey, $objCustomer,
$arrOrderTemp['use_point'],
$objPurchase->getShippingPref($this->is_multiple),
$arrOrderTemp['charge'],
$arrOrderTemp['discount'],
$arrOrderTemp['deliv_id'],
$arrOrderTemp['order_pref'], // 税金計算の為に追加 注文者基準
$arrOrderTemp['order_country_id'] // 税金計算の為に追加 注文者基準
);
$this->arrForm = array_merge($arrOrderTemp, $arrCalcResults);

array_merge()で警告が出る時がある。
恐らく、注文完了後のブラウザバック等の時(未検証)

SC_Query::getRow()の返り値がnullなのが問題の原点ですが。

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.67%. Comparing base (a22be23) to head (7d2171c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1070   +/-   ##
=======================================
  Coverage   51.67%   51.67%           
=======================================
  Files          80       80           
  Lines       10224    10225    +1     
=======================================
+ Hits         5283     5284    +1     
  Misses       4941     4941           
Flag Coverage Δ
tests 51.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@nanasess nanasess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正方針は問題ございません。

SC_Helper_Purchase_getOrderTempTest::testGetOrderTemp存在しない受注IDを指定した場合結果が空になる() の結果が null を想定しているようですので、こちらも空の array に修正お願いできますでしょうか。

@@ -260,7 +260,8 @@ public static function getOrderTemp($uniqId)
{
$objQuery = SC_Query_Ex::getSingletonInstance();

return $objQuery->getRow('*', 'dtb_order_temp', 'order_temp_id = ?', [$uniqId]);
$result = $objQuery->getRow('*', 'dtb_order_temp', 'order_temp_id = ?', array($uniqId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$result = $objQuery->getRow('*', 'dtb_order_temp', 'order_temp_id = ?', array($uniqId));
$result = $objQuery->getRow('*', 'dtb_order_temp', 'order_temp_id = ?', [$uniqId]);

#996 より、short syntax に統一しているため修正をお願いします

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants