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

PHP7 での警告を修正 #285

Merged
merged 12 commits into from
Jul 30, 2019
4 changes: 2 additions & 2 deletions ctests/acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

$category_ids = $objGenerator->createCategories();
foreach ($product_ids as $product_id) {
$objGenerator->relateProductCategories($product_id, array_rand($category_ids, $faker->numberBetween(1, count($category_ids) - 1)));
$objGenerator->relateProductCategories($product_id, array_rand(array_flip($category_ids), $faker->numberBetween(2, count($category_ids) - 1)));
}
$objDb = new SC_Helper_DB_Ex();
$objDb->sfCountCategory($objQuery);
Expand All @@ -52,7 +52,7 @@
if ($num < $config['fixture_order_num']) {
echo 'Generating Orders';
foreach ($customer_ids as $customer_id) {
$target_product_class_ids = $product_class_ids[$faker->numberBetween(0, count($product_class_ids) - 1)];
$target_product_class_ids = array_rand(array_flip($product_class_ids), $faker->numberBetween(2, count($product_class_ids) - 1));
$charge = $faker->randomNumber(4);
$discount = $faker->numberBetween(0, $charge);
$order_count_per_customer = $objQuery->count('dtb_order', 'customer_id = ?', [$customer_id]);
Expand Down
9 changes: 0 additions & 9 deletions data/Smarty/templates/admin/main_frame.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@
<!--{$tpl_onload}-->
});
//]]></script>
<!--{* ▼Head COLUMN*}-->
<!--{if $arrPageLayout.HeadNavi|@count > 0}-->
<!--{foreach key=HeadNaviKey item=HeadNaviItem from=$arrPageLayout.HeadNavi}-->
<!--{if $HeadNaviItem.php_path != ""}-->
<!--{include_php_ex file=$HeadNaviItem.php_path}-->
<!--{/if}-->
<!--{/foreach}-->
<!--{/if}-->
<!--{* ▲Head COLUMN*}-->
</head>

<body class="<!--{if strlen($tpl_authority) >= 1}-->authority_<!--{$tpl_authority}--><!--{/if}-->">
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/admin/order/disp.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
</td>
</tr>

<!--{if $arrForm.payment_info|@count > 0}-->
<!--{if !empty($arrForm.payment_info)}-->
<tr>
<th><!--{$arrForm.payment_type}-->情報</th>
<td>
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/admin/order/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@
</td>
</tr>

<!--{if $arrForm.payment_info|@count > 0}-->
<!--{if !empty($arrForm.payment_info)}-->
<tr>
<th><!--{$arrForm.payment_type}-->情報</th>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<!--{foreach from=$arrHookPoint item=hookpoint}-->
<!--{foreach from=$hookpoint item=val name="plugin"}-->
<tr>
<!--{if $hookpoint|@count > 0 && $smarty.foreach.plugin.iteration == '1'}-->
<!--{if !empty($hookpoint) && $smarty.foreach.plugin.iteration == '1'}-->
<td <!--{if in_array($val.hook_point, $arrConflict)}-->bgcolor="pink"<!--{/if}--> rowspan="<!--{$hookpoint|@count}-->">
<!--{$val.hook_point}-->
<!--{if in_array($val.hook_point, $arrConflict)}--><br /><span class="attention">※ 競合中</span><!--{/if}-->
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/default/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div id="header_utility">
<div id="headerInternalColumn">
<!--{* ▼HeaderInternal COLUMN *}-->
<!--{if $arrPageLayout.HeaderInternalNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.HeaderInternalNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=HeaderInternalNaviKey item=HeaderInternalNaviItem from=$arrPageLayout.HeaderInternalNavi}-->
<!-- ▼<!--{$HeaderInternalNaviItem.bloc_name}--> -->
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/default/products/detail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<div id="detailrightbloc">
<!--▼商品ステータス-->
<!--{assign var=ps value=$productStatus[$tpl_product_id]}-->
<!--{if count($ps) > 0}-->
<!--{if !empty($ps)}-->
<ul class="status_icon clearfix">
<!--{foreach from=$ps item=status}-->
<li>
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/default/products/list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@

<div class="listrightbloc">
<!--▼商品ステータス-->
<!--{if count($productStatus[$id]) > 0}-->
<!--{if !empty($productStatus[$id])}-->
<ul class="status_icon clearfix">
<!--{foreach from=$productStatus[$id] item=status}-->
<li>
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/mobile/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!--{strip}-->
<!--▼HEADER-->
<!--{* ▼HeaderInternal COLUMN*}-->
<!--{if $arrPageLayout.HeaderInternalNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.HeaderInternalNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=HeaderInternalNaviKey item=HeaderInternalNaviItem from=$arrPageLayout.HeaderInternalNavi}-->
<!-- ▼<!--{$HeaderInternalNaviItem.bloc_name}--> -->
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/mobile/site_frame.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<meta name="robots" content="<!--{$arrPageLayout.meta_robots|h}-->">
<!--{/if}-->
<!--{* ▼Head COLUMN *}-->
<!--{if $arrPageLayout.HeadNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.HeadNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=HeadNaviKey item=HeadNaviItem from=$arrPageLayout.HeadNavi}-->
<!-- ▼「<!--{$HeadNaviItem.bloc_name|h}-->」ブロック -->
Expand Down
12 changes: 6 additions & 6 deletions data/Smarty/templates/mobile/site_main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!--{/if}-->

<!--{* ▼HeaderHeaderTop COLUMN *}-->
<!--{if $arrPageLayout.HeaderTopNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.HeaderTopNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=HeaderTopNaviKey item=HeaderTopNaviItem from=$arrPageLayout.HeaderTopNavi}-->
<!-- ▼<!--{$HeaderTopNaviItem.bloc_name}--> -->
Expand All @@ -53,7 +53,7 @@
<!--{* ▲HEADER *}-->

<!--{* ▼TOP COLUMN *}-->
<!--{if $arrPageLayout.TopNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.TopNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=TopNaviKey item=TopNaviItem from=$arrPageLayout.TopNavi}-->
<!-- ▼<!--{$TopNaviItem.bloc_name}--> -->
Expand All @@ -69,7 +69,7 @@
<!--{* ▲TOP COLUMN *}-->

<!--{* ▼メイン上部 *}-->
<!--{if $arrPageLayout.MainHead|@count > 0}-->
<!--{if !empty($arrPageLayout.MainHead)}-->
<!--{foreach key=MainHeadKey item=MainHeadItem from=$arrPageLayout.MainHead}-->
<!-- ▼<!--{$MainHeadItem.bloc_name}--> -->
<!--{if $MainHeadItem.php_path != ""}-->
Expand All @@ -87,7 +87,7 @@
<!--▲MAIN-->

<!--{* ▼メイン下部 *}-->
<!--{if $arrPageLayout.MainFoot|@count > 0}-->
<!--{if !empty($arrPageLayout.MainFoot)}-->
<!--{foreach key=MainFootKey item=MainFootItem from=$arrPageLayout.MainFoot}-->
<!-- ▼<!--{$MainFootItem.bloc_name}--> -->
<!--{if $MainFootItem.php_path != ""}-->
Expand All @@ -101,7 +101,7 @@
<!--{* ▲メイン下部 *}-->

<!--{* ▼BOTTOM COLUMN*}-->
<!--{if $arrPageLayout.BottomNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.BottomNavi)}-->
<!--{* ▼下ナビ *}-->
<!--{foreach key=BottomNaviKey item=BottomNaviItem from=$arrPageLayout.BottomNavi}-->
<!-- ▼<!--{$BottomNaviItem.bloc_name}--> -->
Expand All @@ -123,7 +123,7 @@
<!--{* ▲FOOTER *}-->

<!--{* ▼FooterBottom COLUMN *}-->
<!--{if $arrPageLayout.FooterBottomNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.FooterBottomNavi)}-->
<!--{* ▼上ナビ *}-->
<!--{foreach key=FooterBottomNaviKey item=FooterBottomNaviItem from=$arrPageLayout.FooterBottomNavi}-->
<!-- ▼<!--{$FooterBottomNaviItem.bloc_name}--> -->
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/sphone/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<div class="header_utility">
<!--{* ▼HeaderInternal COLUMN *}-->
<!--{if $arrPageLayout.HeaderInternalNavi|@count > 0}-->
<!--{if !empty($arrPageLayout.HeaderInternalNavi)}-->
<!--{foreach key=HeaderInternalNaviKey item=HeaderInternalNaviItem from=$arrPageLayout.HeaderInternalNavi}-->
<!-- ▼<!--{$HeaderInternalNaviItem.bloc_name}--> -->
<!--{if $HeaderInternalNaviItem.php_path != ""}-->
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/sphone/products/detail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<div id="detailrightblock">
<!--▼商品ステータス-->
<!--{assign var=ps value=$productStatus[$tpl_product_id]}-->
<!--{if count($ps) > 0}-->
<!--{if !empty($ps)}-->
<ul class="status_icon">
<!--{foreach from=$ps item=status}-->
<li><!--{$arrSTATUS[$status]}--></li>
Expand Down
2 changes: 1 addition & 1 deletion data/Smarty/templates/sphone/products/list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<div class="listrightblock">
<div class="statusArea">
<!--▼商品ステータス-->
<!--{if count($productStatus[$id]) > 0}-->
<!--{if !empty($productStatus[$id])}-->
<ul class="status_icon">
<!--{foreach from=$productStatus[$id] item=status}-->
<li><!--{$arrSTATUS[$status]}--></li>
Expand Down
11 changes: 6 additions & 5 deletions data/class/SC_CartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function saveCurrentCart($key_tmp, $productTypeId)
{
$this->key_tmp = 'savecart_' . $key_tmp;
// すでに情報がなければ現状のカート情報を記録しておく
if (count($_SESSION[$this->key_tmp]) == 0) {
if (!isset($_SESSION[$this->key_tmp])) {
$_SESSION[$this->key_tmp] = $this->cartSession[$productTypeId];
}
// 1世代古いコピー情報は、削除しておく
Expand Down Expand Up @@ -140,7 +140,8 @@ public function setProductValue($id, $key, $val, $productTypeId)
public function getMax($productTypeId)
{
$max = 0;
if (count($this->cartSession[$productTypeId]) > 0) {
if (is_array($this->cartSession[$productTypeId])
&& count($this->cartSession[$productTypeId]) > 0) {
foreach ($this->cartSession[$productTypeId] as $key => $value) {
if (is_numeric($key)) {
if ($max < $key) {
Expand Down Expand Up @@ -187,7 +188,7 @@ public function getAllProductsTotal($productTypeId, $pref_id = 0, $country_id =
$this->cartSession[$productTypeId][$i]['productsClass']['product_class_id'],
$pref_id, $country_id);

$total+= ($incTax * $quantity);
$total += ($incTax * (int) $quantity);
}

return $total;
Expand All @@ -207,7 +208,7 @@ public function getAllProductsTax($productTypeId, $pref_id = 0, $country_id = 0)
$this->cartSession[$productTypeId][$i]['productsClass']['product_class_id'],
$pref_id, $country_id);

$total+= ($tax * $quantity);
$total += ($tax * (int) $quantity);
}

return $total;
Expand All @@ -234,7 +235,7 @@ public function getAllProductsPoint($productTypeId)
$point_rate = $this->cartSession[$productTypeId][$i]['point_rate'];

$point = SC_Utils_Ex::sfPrePoint($price, $point_rate);
$total+= ($point * $quantity);
$total += ($point * (int) $quantity);
}
}

Expand Down
20 changes: 10 additions & 10 deletions data/class/SC_CheckError.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ public function CHECK_DATE($value)
if (!(strlen($input_year) > 0 && strlen($input_month) > 0 && strlen($input_day) > 0)) {
$this->arrErr[$keyname] =
"※ {$disp_name}は全ての項目を入力して下さい。<br />";
} elseif (!checkdate($input_month, $input_day, $input_year)) {
} elseif (!checkdate((int) $input_month, (int) $input_day, (int) $input_year)) {
$this->arrErr[$keyname] =
"※ {$disp_name}が正しくありません。<br />";
}
Expand Down Expand Up @@ -1277,7 +1277,7 @@ public function CHECK_DATE2($value)
if (!(strlen($input_year) > 0 && strlen($input_month) > 0 && strlen($input_day) > 0 && strlen($input_hour) > 0 && strlen($input_minute) > 0)) {
$this->arrErr[$keyname] =
"※ {$disp_name}は全ての項目を入力して下さい。<br />";
} elseif (! checkdate($input_month, $input_day, $input_year)) {
} elseif (! checkdate((int) $input_month, (int) $input_day, (int) $input_year)) {
$this->arrErr[$keyname] =
"※ {$disp_name}が正しくありません。<br />";
}
Expand Down Expand Up @@ -1307,7 +1307,7 @@ public function CHECK_DATE3($value)
if (!(strlen($input_year) > 0 && strlen($input_month) > 0)) {
$this->arrErr[$keyname] =
"※ {$disp_name}は全ての項目を入力して下さい。<br />";
} elseif (! checkdate($input_month, 1, $input_year)) {
} elseif (! checkdate((int) $input_month, 1, (int) $input_year)) {
$this->arrErr[$keyname] =
"※ {$disp_name}が正しくありません。<br />";
}
Expand Down Expand Up @@ -1392,13 +1392,13 @@ public function CHECK_SET_TERM($value)
$end_month = $this->arrParam[$value[6]];
$end_day = $this->arrParam[$value[7]];
if ((strlen($start_year) > 0 || strlen($start_month) > 0 || strlen($start_day) > 0)
&& ! checkdate($start_month, $start_day, $start_year)
&& ! checkdate((int) $start_month, (int) $start_day, (int) $start_year)
) {
$this->arrErr[$keyname1] =
"※ {$disp_name1}を正しく指定してください。<br />";
}
if ((strlen($end_year) > 0 || strlen($end_month) > 0 || strlen($end_day) > 0)
&& ! checkdate($end_month, $end_day, $end_year)
&& ! checkdate((int) $end_month, (int) $end_day, (int) $end_year)
) {
$this->arrErr[$keyname2] =
"※ {$disp_name2}を正しく指定してください。<br />";
Expand Down Expand Up @@ -1469,13 +1469,13 @@ public function CHECK_SET_TERM2($value)
$end_minute = $this->arrParam[$value[12]];
$end_second = $this->arrParam[$value[13]];
if ((strlen($start_year) > 0 || strlen($start_month) > 0 || strlen($start_day) > 0 || strlen($start_hour) > 0)
&& ! checkdate($start_month, $start_day, $start_year)
&& ! checkdate((int) $start_month, (int) $start_day, (int) $start_year)
) {
$this->arrErr[$keyname1] =
"※ {$disp_name1}を正しく指定してください。<br />";
}
if ((strlen($end_year) > 0 || strlen($end_month) > 0 || strlen($end_day) > 0 || strlen($end_hour) > 0)
&& ! checkdate($end_month, $end_day, $end_year)
&& ! checkdate((int) $end_month, (int) $end_day, (int) $end_year)
) {
$this->arrErr[$keyname2] =
"※ {$disp_name2}を正しく指定してください。<br />";
Expand Down Expand Up @@ -1536,13 +1536,13 @@ public function CHECK_SET_TERM3($value)
$end_year = $this->arrParam[$value[4]];
$end_month = $this->arrParam[$value[5]];
if ((strlen($start_year) > 0 || strlen($start_month) > 0)
&& ! checkdate($start_month, 1, $start_year)
&& ! checkdate((int) $start_month, 1, (int) $start_year)
) {
$this->arrErr[$keyname1] =
"※ {$disp_name1}を正しく指定してください。<br />";
}
if ((strlen($end_year) > 0 || strlen($end_month) > 0)
&& ! checkdate($end_month, 1, $end_year)
&& ! checkdate((int) $end_month, 1, (int) $end_year)
) {
$this->arrErr[$keyname2] =
"※ {$disp_name2}を正しく指定してください。<br />";
Expand Down Expand Up @@ -1733,7 +1733,7 @@ public function createParam($value)
if ($val_key != 0 && (is_string($key) || is_int($key))) {
if (!is_numeric($key) && preg_match('/^[a-z0-9_]+$/i', $key)) {
if (!isset($this->arrParam[$key])) $this->arrParam[$key] = '';
if (strlen($this->arrParam[$key]) > 0
if (!is_array($this->arrParam[$key]) && strlen($this->arrParam[$key]) > 0
&& (preg_match('/^[[:alnum:]\-\_]*[\.\/\\\\]*\.\.(\/|\\\\)/', $this->arrParam[$key]) || !preg_match('/\A[^\x00-\x08\x0b\x0c\x0e-\x1f\x7f]+\z/u', $this->arrParam[$key]))) {
$this->arrErr[$value[1]] = '※ ' . $value[0] . 'に禁止された記号の並びまたは制御文字が入っています。<br />';
}
Expand Down
5 changes: 4 additions & 1 deletion data/class/SC_Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public function logout()
*/
public function regenerateSID()
{
return session_regenerate_id(true);
if (session_status() === PHP_SESSION_ACTIVE) {
return session_regenerate_id(true);
}
return false;
}
}
2 changes: 1 addition & 1 deletion data/class/graph/SC_Graph_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function debugPrint($text)
public function drawLegend($legend_max = '', $clabelbg = true)
{
// 凡例が登録されていなければ中止
if (count($this->arrLegend) <= 0) {
if (empty($this->arrLegend)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions data/class/graph/SC_Graph_Pie.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function __construct($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT,
// データを360°値に変換する
public function getCircleData($array)
{
$total = '';
$new_total = '';
$total = 0;
$new_total = 0;
if (!is_array($array)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions data/class/helper/SC_Helper_Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public function rollbackOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete
$uniqid = $objSiteSession->getUniqId();

if (!empty($arrOrderTemp)) {

$_SESSION = array_merge($_SESSION, unserialize($arrOrderTemp['session']));
$tempSession = unserialize($arrOrderTemp['session']);
$_SESSION = array_merge($_SESSION, $tempSession === false ? [] : $tempSession);

$objCartSession = new SC_CartSession_Ex();
$objCustomer = new SC_Customer_Ex();
Expand Down Expand Up @@ -324,7 +324,7 @@ public function getShippingTemp($has_shipment_item = false)
if ($has_shipment_item) {
$arrReturn = array();
foreach ($_SESSION['shipping'] as $key => $arrVal) {
if (count($arrVal['shipment_item']) == 0) continue;
if (is_array($arrVal['shipment_item']) && count($arrVal['shipment_item']) == 0) continue;
$arrReturn[$key] = $arrVal;
}

Expand Down Expand Up @@ -759,7 +759,7 @@ public function registerShipmentItem($order_id, $shipping_id, $arrParams)
* @param array $orderParams 登録する受注情報の配列
* @param SC_CartSession $objCartSession カート情報のインスタンス
* @param integer $cartKey 登録を行うカート情報のキー
* @param integer 受注ID
* @return integer 受注ID
*/
public function registerOrderComplete($orderParams, &$objCartSession, $cartKey)
{
Expand Down
14 changes: 8 additions & 6 deletions data/class/helper/SC_Helper_Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ class SC_Helper_Session
public function __construct()
{
$this->objDb = new SC_Helper_DB_Ex();
session_set_save_handler(array(&$this, 'sfSessOpen'),
array(&$this, 'sfSessClose'),
array(&$this, 'sfSessRead'),
array(&$this, 'sfSessWrite'),
array(&$this, 'sfSessDestroy'),
array(&$this, 'sfSessGc'));
if (session_status() !== PHP_SESSION_ACTIVE) {
session_set_save_handler(array(&$this, 'sfSessOpen'),
array(&$this, 'sfSessClose'),
array(&$this, 'sfSessRead'),
array(&$this, 'sfSessWrite'),
array(&$this, 'sfSessDestroy'),
array(&$this, 'sfSessGc'));
}

// 通常よりも早い段階(オブジェクトが破棄される前)でセッションデータを書き込んでセッションを終了する
// XXX APC による MDB2 の破棄タイミングによる不具合を回避する目的
Expand Down
Loading