setup:di:compile breaks on 0 indexed object arrays #8803
Labels
bug report
Fixed in 2.2.x
The issue has been fixed in 2.2 release line
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Issue: Format is valid
Gate 1 Passed. Automatic verification of issue format passed
Reproduced on 2.1.x
The issue has been reproduced on latest 2.1 release
Array arguments defined containing 0-indexed object items break setup:di:compile with the following exception:
A sample
di.xml
breaking down:NOTE the
<item name="0" xsi:type="object">SomeInterface</item>
which is a0
-indexed object item referring to an interface.Normally the code should not be executed on array because lines 65-67 trigger a recursive call on array values. However
ltrim
can be called on array if the conditionin_array($key, ['_i_', '_ins_'])
evaluates totrue
and$value
is array. This does evaluate to true for$key = 0
, which can happen when resolving array parameters. Surprisingly expressionin_array(0, ['_i_', '_ins_'])
evaluates to true, because each value in array['_i_', '_ins_']
will be converted tointeger
when the needle is of typeinteger
.0
is therefore always is in['_i_', '_ins_']
.With the sample
di.xml
the code will eventually be called with:Which causes the crash.
Preconditions
Steps to reproduce
di.xml
into any module.setup:di:compile
Expected result
Actual result
The text was updated successfully, but these errors were encountered: