resolved PHP warnings when converting object to array