[Bug 56498] Incorrect substring expansion for magic variables