Skip to content

Commit f35d5b9

Browse files
authored
Merge pull request #3747 from plentymarkets/hotfix/php82
add check for random_int
2 parents c7b70f4 + d2f086d commit f35d5b9

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Ceres",
33
"license": "AGPL-3.0",
4-
"version": "5.0.74",
4+
"version": "5.0.76",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/plentymarkets/plugin-ceres.git"

plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version" : "5.0.75",
2+
"version" : "5.0.76",
33
"name" : "Ceres",
44
"marketplaceName" : {"de": "plentyShop LTS","en": "plentyShop LTS"},
55
"description" : "This is the official plentyShop LTS plugin developed by PlentyONE. plentyShop LTS is the default template plugin for PlentyONE online stores.",
@@ -15,7 +15,7 @@
1515
"keywords" : ["plentymarkets", "plugins", "layout", "template", "ceres", "plentyshop", "webshop", "PlentyONE"],
1616
"type" : "template",
1717
"require" : {
18-
"IO": "~5.0.75"
18+
"IO": "~5.0.76"
1919
},
2020
"platform": {
2121
"php": ">=7.3 <8.1"

src/Widgets/MyAccount/OrderHistoryWidget.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,9 @@ protected function getTemplateData($widgetSettings, $isPreview)
9999
{
100100
$previewData = null;
101101

102-
if ( $isPreview )
103-
{
102+
if ($isPreview) {
104103
$previewData = $this->mockPaginatedResult(
105-
function($i)
106-
{
104+
function ($i) {
107105
return [
108106
"id" => $i,
109107
"total" => random_int(100, 100000) / 100,
@@ -112,7 +110,6 @@ function($i)
112110
];
113111
},
114112
$widgetSettings["ordersPerPage"]["mobile"] ?? 5
115-
116113
);
117114
}
118115

@@ -123,33 +120,29 @@ function($i)
123120

124121
private function getRandomStatusName()
125122
{
126-
if ( is_null($this->statuses) )
127-
{
123+
if (is_null($this->statuses)) {
128124
$this->statuses = [];
129125
/** @var AuthHelper $authHelper */
130126
$authHelper = pluginApp(AuthHelper::class);
131-
$statuses = $authHelper->processUnguarded(function() {
127+
$statuses = $authHelper->processUnguarded(function () {
132128
/** @var OrderStatusRepositoryContract $orderStatusRepo */
133129
$orderStatusRepo = pluginApp(OrderStatusRepositoryContract::class);
134130
return $orderStatusRepo->all();
135131
});
136132

137133
/** @var OrderStatus $status */
138-
foreach( $statuses as $status )
139-
{
140-
if ($status->isFrontendVisible)
141-
{
134+
foreach ($statuses as $status) {
135+
if ($status->isFrontendVisible) {
142136
$this->statuses[] = $status;
143137
}
144138
}
145139
$this->lang = Utils::getLang();
146140
}
147141

148-
$idx = random_int(0, count($this->statuses) - 1);
142+
$idx = random_int(0, max(count($this->statuses) - 1, 0));
149143
$status = $this->statuses[$idx];
150144

151-
if (isset($status))
152-
{
145+
if (isset($status)) {
153146
return $status->names[$this->lang];
154147
}
155148

0 commit comments

Comments
 (0)