Skip to content

Commit e0dc9ef

Browse files
Fix undefined offset notice when no order states are set
When the DB has no order states (or just missing non-visible, or visible ones), M2 throws with `Notice: Undefined offset: 1 in /vagrant/vendor/magento/module-sales/Model/Order/Config.php on line 256`. You can argue that M2 shouldn't take into consideration invalid DBs, and I would just slightly agree with you, but, for such a small fix, why bother arguing that in the first place, eh?
1 parent a5fa3af commit e0dc9ef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/code/Magento/Sales/Model/Order/Config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ public function getInvisibleOnFrontStatuses()
248248
protected function _getStatuses($visibility)
249249
{
250250
if ($this->statuses == null) {
251+
252+
$this->statuses = [ true => [], false => [] ];
253+
251254
foreach ($this->_getCollection() as $item) {
252255
$visible = (bool) $item->getData('visible_on_front');
253256
$this->statuses[$visible][] = $item->getData('status');

0 commit comments

Comments
 (0)