Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Dec 12, 2024
1 parent 4183a07 commit 3e7f879
Show file tree
Hide file tree
Showing 25 changed files with 67 additions and 37 deletions.
23 changes: 21 additions & 2 deletions data/class/SC_CartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function getNextCartID($product_type_id)
{
$count = [];
foreach ($this->cartSession[$product_type_id] as $key => $value) {
$count[] = $this->cartSession[$product_type_id][$key]['cart_no'];
$count[] = $this->cartSession[$product_type_id][$key]['cart_no'] ?? null;
}

return max($count) + 1;
Expand Down Expand Up @@ -147,7 +147,8 @@ public function getMax($product_type_id)
{
$max = 0;
if (
is_array($this->cartSession[$product_type_id])
isset($this->cartSession[$product_type_id])
&& is_array($this->cartSession[$product_type_id])
&& count($this->cartSession[$product_type_id]) > 0
) {
foreach ($this->cartSession[$product_type_id] as $key => $value) {
Expand All @@ -157,6 +158,24 @@ public function getMax($product_type_id)
}
}
}
} else {
$this->cartSession[$product_type_id] = [];
}

// カート内商品の最大要素番号までの要素が存在しない場合、要素を追加しておく
for ($i = 0; $i <= $max; $i++) {
if (!array_key_exists($i, $this->cartSession[$product_type_id])) {
$this->cartSession[$product_type_id][$i] = [
'id' => null,
'cart_no' => null,
'price' => 0,
'quantity' => 0,
'productsClass' => [
'product_id' => null,
'product_class_id' => null,
],
];
}
}

return $max;
Expand Down
2 changes: 1 addition & 1 deletion data/class/SC_CheckError.php
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ public function CHECK_SET_TERM($value)
$date1 = sprintf('%d%02d%02d000000', $start_year, $start_month, $start_day);
$date2 = sprintf('%d%02d%02d235959', $end_year, $end_month, $end_day);

if (($this->arrErr[$keyname1] == '' && $this->arrErr[$keyname2] == '') && $date1 > $date2) {
if ((!isset($this->arrErr[$keyname1]) && !isset($this->arrErr[$keyname2])) && $date1 > $date2) {
$this->arrErr[$keyname1] =
"{$disp_name1}{$disp_name2}の期間指定が不正です。<br />";
}
Expand Down
9 changes: 6 additions & 3 deletions data/class/SC_Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,12 @@ public function getValue($keyname)
{
// ポイントはリアルタイム表示
if ($keyname == 'point') {
$objQuery = SC_Query_Ex::getSingletonInstance();
$point = $objQuery->get('point', 'dtb_customer', 'customer_id = ?', [$_SESSION['customer']['customer_id']]);
$_SESSION['customer']['point'] = $point;
$point = 0;
if (isset($_SESSION['customer']['customer_id'])) {
$objQuery = SC_Query_Ex::getSingletonInstance();
$point = $objQuery->get('point', 'dtb_customer', 'customer_id = ?', [$_SESSION['customer']['customer_id']]);
$_SESSION['customer']['point'] = $point;
}

return $point;
} else {
Expand Down
2 changes: 1 addition & 1 deletion data/class/SC_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function sendRedirect($location, $arrQueryString = [], $inheritQue
}

// url-path → URL 変換
if ($location[0] === '/') {
if ($location !== '' && $location[0] === '/') {
$netUrl = new Net_URL($location);
$location = $netUrl->getUrl();
}
Expand Down
2 changes: 1 addition & 1 deletion data/class/SC_UploadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function makeTempFile($keyname, $rename = IMAGE_RENAME)
}
}

return $objErr->arrErr[$keyname];
return $objErr->arrErr[$keyname] ?? '';
}

// アップロードされたダウンロードファイルを保存する。
Expand Down
2 changes: 1 addition & 1 deletion data/class/helper/SC_Helper_Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function delivErrorCheck($arrParam)
$error_flg = true;
}

if (strlen($arrParam['other_deliv_id']) > 0 && (!is_numeric($arrParam['other_deliv_id']) || !preg_match("/^\d+$/", $arrParam['other_deliv_id']))) {
if (isset($arrParam['other_deliv_id']) && (!is_numeric($arrParam['other_deliv_id']) || !preg_match("/^\d+$/", $arrParam['other_deliv_id']))) {
$error_flg = true;
}

Expand Down
2 changes: 1 addition & 1 deletion data/class/helper/SC_Helper_Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static function sfEditCustomerData($arrData, $customer_id = null)
$customer_id = $objQuery->nextVal('dtb_customer_customer_id');
$arrData['customer_id'] = $customer_id;
// 作成日
if (is_null($arrData['create_date'])) {
if (!isset($arrData['create_date'])) {
$arrData['create_date'] = 'CURRENT_TIMESTAMP';
}
$objQuery->insert('dtb_customer', $arrData);
Expand Down
4 changes: 2 additions & 2 deletions data/class/helper/SC_Helper_Maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function getMaker($maker_id, $has_deleted = false)
if (!$has_deleted) {
$where .= ' AND del_flg = 0';
}
$arrRet = $objQuery->select('*', 'dtb_maker', $where, [$maker_id]);
$arrRet = $objQuery->getRow('*', 'dtb_maker', $where, [$maker_id]);

return $arrRet[0];
return $arrRet;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions data/class/helper/SC_Helper_Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public static function saveOrderTemp($uniqId, $params, &$objCustomer = null)
$exists = SC_Helper_Purchase_Ex::getOrderTemp($uniqId);

// 国ID追加
$sqlval['order_country_id'] = ($sqlval['order_country_id']) ? $sqlval['order_country_id'] : DEFAULT_COUNTRY_ID;
$sqlval['order_country_id'] = isset($sqlval['order_country_id']) ? $sqlval['order_country_id'] : DEFAULT_COUNTRY_ID;

if (SC_Utils_Ex::isBlank($exists)) {
$sqlval['order_temp_id'] = $uniqId;
Expand Down Expand Up @@ -780,23 +780,23 @@ public static function registerShipmentItem($order_id, $shipping_id, $arrParams)
continue;
}
$d = $objProduct->getDetailAndProductsClass($arrValues['product_class_id']);
$name = SC_Utils_Ex::isBlank($arrValues['product_name'])
$name = !isset($arrValues['product_name'])
? $d['name']
: $arrValues['product_name'];

$code = SC_Utils_Ex::isBlank($arrValues['product_code'])
$code = !isset($arrValues['product_code'])
? $d['product_code']
: $arrValues['product_code'];

$cname1 = SC_Utils_Ex::isBlank($arrValues['classcategory_name1'])
$cname1 = !isset($arrValues['classcategory_name1'])
? $d['classcategory_name1']
: $arrValues['classcategory_name1'];

$cname2 = SC_Utils_Ex::isBlank($arrValues['classcategory_name2'])
$cname2 = !isset($arrValues['classcategory_name2'])
? $d['classcategory_name2']
: $arrValues['classcategory_name2'];

$price = SC_Utils_Ex::isBlank($arrValues['price'])
$price = !isset($arrValues['price'])
? $d['price']
: $arrValues['price'];

Expand Down
2 changes: 1 addition & 1 deletion data/class/helper/SC_Helper_Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function createToken()
public static function isValidToken($is_unset = false)
{
// token の妥当性チェック
$ret = $_REQUEST[TRANSACTION_ID_NAME] === $_SESSION[TRANSACTION_ID_NAME];
$ret = ($_REQUEST[TRANSACTION_ID_NAME] ?? '') === ($_SESSION[TRANSACTION_ID_NAME] ?? '');

if (empty($_REQUEST[TRANSACTION_ID_NAME]) || empty($_SESSION[TRANSACTION_ID_NAME])) {
$ret = false;
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/admin/LC_Page_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function init()
}
}

$this->tpl_authority = $_SESSION['authority'];
$this->tpl_authority = $_SESSION['authority'] ?? '';

// ディスプレイクラス生成
$this->objDisplay = new SC_Display_Ex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function action()
break;
case 'set_item': // 商品を選択する。
$this->arrErr = $this->lfCheckError($objFormParam);
if (SC_Utils_Ex::isBlank($this->arrErr['rank']) && SC_Utils_Ex::isBlank($this->arrErr['product_id'])) {
if (SC_Utils_Ex::isBlank($this->arrErr['rank'] ?? '') && SC_Utils_Ex::isBlank($this->arrErr['product_id'] ?? '')) {
$arrItems = $this->setProducts($arrPost, $this->getRecommendProducts($objRecommend));
$this->checkRank = $arrPost['rank'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function action()
$wheres = $this->createWhere($objFormParam, $objDb);
$this->tpl_linemax = $this->getLineCount($wheres, $objProduct);

$page_max = SC_Utils_Ex::sfGetSearchPageMax($arrPost['search_page_max']);
$page_max = SC_Utils_Ex::sfGetSearchPageMax($arrPost['search_page_max'] ?? 0);

// ページ送りの取得
$objNavi = new SC_PageNavi_Ex($arrPost['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public function getPluginInfo(ReflectionClass $objReflection)
if (isset($arrStaticProps[$key])) {
$arrPluginInfo[$key] = $arrStaticProps[$key];
// クラス変数定義がなければ, クラス定数での定義を読み込み.
} elseif ($arrConstants[$key]) {
} elseif (isset($arrConstants[$key])) {
$arrPluginInfo[$key] = $arrConstants[$key];
} else {
$arrPluginInfo[$key] = null;
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/admin/system/LC_Page_Admin_System.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function action()
= $this->getMemberCount('work = 1 AND del_flg <> 1 AND member_id <> '.ADMIN_ID);

// ページ送りの処理 $_GET['pageno']が信頼しうる値かどうかチェックする。
$pageno = $this->lfCheckPageNo($_GET['pageno']);
$pageno = $this->lfCheckPageNo($_GET['pageno'] ?? 1);

$objNavi = new SC_PageNavi_Ex($pageno, $linemax, MEMBER_PMAX, 'eccube.moveMemberPage', NAVI_PMAX);
$this->tpl_strnavi = $objNavi->strnavi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function action()
$objFormParam = new SC_FormParam_Ex();

// ページ送りの処理 $_REQUEST['pageno']が信頼しうる値かどうかチェックする。
$this->tpl_pageno = $this->lfCheckPageNo($_REQUEST['pageno']);
$this->tpl_pageno = $this->lfCheckPageNo($_REQUEST['pageno'] ?? 1);

$arrErr = [];
$arrForm = [];
Expand Down
7 changes: 5 additions & 2 deletions data/class/pages/admin/total/LC_Page_Admin_Total.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,15 @@ public function lfAddTotalLine($arrResults)
// 合計の計算
foreach ($arrResults as $arrResult) {
foreach ($arrResult as $key => $value) {
if (!isset($arrTotal[$key])) {
$arrTotal[$key] = 0;
}
$arrTotal[$key] += (int) $arrResult[$key];
}
}
// 平均値の計算
$arrTotal['total_average'] = 0;
if ($arrTotal['total_order'] > 0) {
if (isset($arrTotal['total_order']) && $arrTotal['total_order'] > 0) {
$arrTotal['total_average'] = $arrTotal['total'] / $arrTotal['total_order'];
}
if (is_nan($arrTotal['total_average'])) {
Expand All @@ -863,7 +866,7 @@ public function lfGetDataColCSV($arrData, $arrDataCol)
$arrRet = [];
for ($i = 0; $i < $max; $i++) {
foreach ($arrDataCol as $val) {
$arrRet[$i][$val] = ($arrData[$i][$val]) ? $arrData[$i][$val] : '0';
$arrRet[$i][$val] = isset($arrData[$i][$val]) ? $arrData[$i][$val] : '0';
}
// 期間別集計の合計行の「期間」項目に不要な値が表示されてしまわない様、'合計'と表示する
if (($i === $max - 1) && isset($arrRet[$i]['str_date'])) {
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/cart/LC_Page_Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function action()
}

// 前頁のURLを取得
$this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER']);
$this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER'] ?? '');
$this->tpl_prev_url = (isset($_SESSION['cart_prev_url'])) ? $_SESSION['cart_prev_url'] : '';

// 全てのカートの内容を取得する
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/mypage/LC_Page_Mypage.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function action()
$customer_id = $objCustomer->getValue('customer_id');

// ページ送り用
$this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'],
$this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'] ?? 1,
$this->lfGetOrderHistory($customer_id),
SEARCH_PMAX,
'eccube.movePage',
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/products/LC_Page_Products_Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ public function lfSetFile(SC_UploadFile $objUpFile, $arrProduct, &$arrFile)
// サブ画像の有無を判定
$subImageFlag = false;
for ($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
if ($arrFile['sub_image'.$i]['filepath'] != '') {
if (isset($arrFile['sub_image'.$i]['filepath'])) {
$subImageFlag = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/products/LC_Page_Products_List.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function lfGetSearchConditionDisp($arrSearchData)
if (strlen($arrSearchData['maker_id']) > 0) {
$objMaker = new SC_Helper_Maker_Ex();
$maker = $objMaker->getMaker($arrSearchData['maker_id']);
$arrSearch['maker'] = $maker['name'];
$arrSearch['maker'] = $maker['name'] ?? '';
}

// 商品名検索条件
Expand Down
4 changes: 2 additions & 2 deletions data/class/pages/shopping/LC_Page_Shopping.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,10 @@ public function setFormParams(&$objFormParam, &$objPurchase, $uniqid)
if (count($arrShippingTemp) > 1) {
$objFormParam->setParam($arrShippingTemp[1]);
} else {
if ($arrOrderTemp['deliv_check'] == 1) {
if (isset($arrOrderTemp['deliv_check']) && $arrOrderTemp['deliv_check'] == 1) {
$objFormParam->setParam($arrShippingTemp[1]);
} else {
$objFormParam->setParam($arrShippingTemp[0]);
$objFormParam->setParam($arrShippingTemp[0] ?? []);
}
}
$objFormParam->setValue('order_email02', $arrOrderTemp['order_email']);
Expand Down
8 changes: 6 additions & 2 deletions data/class/pages/shopping/LC_Page_Shopping_Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function lfCheckError(&$objFormParam, $subtotal, $max_point)
$objErr->doFunc(['ポイントを使用する', 'point_check'], ['EXIST_CHECK']);

if ($arrForm['point_check'] == '1'
&& SC_Utils_Ex::isBlank($objErr->arrErr['use_point'])) {
&& SC_Utils_Ex::isBlank($objErr->arrErr['use_point'] ?? '')) {
$objErr->doFunc(['ポイント', 'use_point'], ['EXIST_CHECK']);
if ($max_point == '') {
$max_point = 0;
Expand Down Expand Up @@ -356,7 +356,11 @@ public function saveShippings(&$objFormParam, $arrDelivTime)
$time_id = $objFormParam->getValue('deliv_time_id'.$shipping_id);
$_SESSION['shipping'][$key]['deliv_id'] = $deliv_id;
$_SESSION['shipping'][$key]['time_id'] = $time_id;
$_SESSION['shipping'][$key]['shipping_time'] = $arrDelivTime[$time_id];
if (isset($arrDelivTime[$time_id])) {
$_SESSION['shipping'][$key]['shipping_time'] = $arrDelivTime[$time_id];
} else {
$_SESSION['shipping'][$key]['shipping_time'] = '';
}
$_SESSION['shipping'][$key]['shipping_date'] = $objFormParam->getValue('deliv_date'.$shipping_id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion data/class/plugin/SC_Plugin_Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function execPlugin()
}

// プラグインのディレクトリコピー
$arrCopyDirectories = $this->arrInstallData['copy_directory'];
$arrCopyDirectories = $this->arrInstallData['copy_directory'] ?? '';

if (!SC_Utils_Ex::isBlank($arrCopyDirectories)) {
foreach ($arrCopyDirectories as $directory) {
Expand Down
3 changes: 2 additions & 1 deletion data/class/plugin/SC_Plugin_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ public static function checkExtension($key)
];
// 必須拡張モジュールのチェック
$arrErr = [];
if (is_array($arrRequireExtension[ECCUBE_VERSION])) {
if (isset($arrRequireExtension[ECCUBE_VERSION])
&& is_array($arrRequireExtension[ECCUBE_VERSION])) {
foreach ($arrRequireExtension[ECCUBE_VERSION] as $val) {
if (!extension_loaded($val)) {
$arrErr[$key] .= "※ プラグインを利用するには、拡張モジュール「{$val}」が必要です。<br />";
Expand Down

0 comments on commit 3e7f879

Please sign in to comment.