A magnitude of 7.9 struck Papua New Guinea, prompting a tsunami warning across parts of the archipelago.