• Resolved ecdltf

    (@ecdltf)


    When I delete old packages I get this PHP warning for each package:

    array_map(): Argument #2 should be an array in <path>/plugins/duplicator/views/actions.php on line 120

    Obviously this is triggered by the result of the glob search for unfinished zip files in /duplicator/views/actions.php:

    $tmpZip = DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*";
    array_map('unlink', glob($tmpZip));

    php.net tells me that glob returns “an empty array if no file matched or FALSE on error” and then “On some systems it is impossible to distinguish between empty match and an error”.

    And indeed the warning does not occure when I put a file with a matching pattern in Duplicator’s tmp directory. This means the system where my site is hosted is one of “some systems”, whatever this should mean ??

    With a simple test for the content of the glob result I can get rid of the warning:

    $tmpZip = glob(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*");
    if ($tmpZip !== false) {
    	array_map('unlink', $tmpZip);
    }

    It would be great if you could implement the code above or an equivalent solution. Otherwise my PHP error widget gets constantly spoiled with these warnings ??

    Thanks for the great plugin!

    Cheers,

    Tom

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘PHP warning when deleting packages’ is closed to new replies.