What are common issues when using ZipArchive in PHP for extracting files?

One common issue when using ZipArchive in PHP for extracting files is not checking if the extraction was successful before proceeding with further operations. To solve this, always check the return value of the extractTo() method to ensure the extraction was successful.

$zip = new ZipArchive;
if ($zip->open('example.zip') === TRUE) {
    $extracted = $zip->extractTo('destination_folder');
    if ($extracted) {
        echo 'Extraction successful';
    } else {
        echo 'Extraction failed';
    }
    $zip->close();
} else {
    echo 'Failed to open zip file';
}