Entry %s does not exist and cannot be deleted¶
Description¶
PHP reports failure when trying to remove a file that does not exists in a phar archive. This error message is specific to the Phar::delete
method.
Example¶
<?php
try {
$phar = new Phar('/tmp/myphar.phar');
$phar->addFromString('foo.txt', 'hello');
unset($phar);
$phar = new Phar('/tmp/myphar.phar');
$phar->delete('/oops');
} catch (Exception $e) {
// handle errors
print $e->getMessage();
}
?>
Literal Examples¶
Entry oops does not exist and cannot be deleted
Solutions¶
Check if the file exists before removing it.