Closed zozlak closed 1 year ago
Hi @zozlak, could you give me an example of what you did to hit this particular situation? I'm just wondering if I'm missing something elsewhere.
$bag = whikloj\BagItTools\Bag::load('TestFilesBag.tgz');
$bag->isValid();
The Undefined property: whikloj\BagItTools\Bag::$tagManifests
error is thrown by the second line.
You can download the test bag file from https://github.com/acdh-oeaw/repo-file-checker/blob/master/_testFiles/BagItTest/bagit/TestFilesBag.tgz
Thanks for bringing this up @zozlak, this should resolve the issue. Let me know if it's good for you.
It's the call to $this->ensureTagManifests();
in loadTagManifests
(line 1641 of Bag.php
) that ensures it is setup.
Right!
I can confirm no error is thrown now.
Could you please make a release including this patch?
Sorry I was trying to think of anything else I might want to do but then dropped it. I have pushed out 4.2.3
If the early-return condition of Bag::loadTagManifest() is met, the
$this->tagManifests
property is left uninitialized leading to theUndefined property: whikloj\BagItTools\Bag::$tagManifests
error, e.g. on a$bag->validate()
call (because of this line).A solution would be to set
$this->tagManifests
before returning, e.g.: