v.22.8Bug Fix

Fix rare issue with array subscript operator behavior

Fix a very rare case of incorrect behavior of array subscript operator. This closes #28720. #40185 (Alexey Milovidov).