Fix php error on switch inventory. closes #2749