- Issue created by @yellowpomelo
- Issue was unassigned.
- Status changed to Postponed: needs info
over 1 year ago 9:48am 26 July 2023 - πΊπΈUnited States mfb San Francisco
I'm not able to reproduce this bug. Are you able to reproduce it on a fresh install of drupal, or is some other contrib or custom module required? Any specific configuration necessary to reproduce it?
Please either update the issue summary with clearer steps to reproduce, or write a failing test that I could use to reproduce the issue.
- πͺπ¨Ecuador afsch Otavalo
I'm gettings the same message, this is running a Behat test to delete a file, in some scenarios, it already exists but in others, it doesn't, the purpose is to make sure that before the tests run the file doesn't exist.
Given I delete a ABC video with ABC manager ID "2cbb517a-2f0c-4ddc-a113-73ea94bee253" if any # tests/features/media/pbs_video/crud.feature:27 Warning: hash_file(public://gpb_remote_media_thumbnails/WdrbXZ_AzM_3MIlpYUcrnp-SeYxR26zZUWDTw0FS_mU.png): Failed to open stream: "Drupal\Core\StreamWrapper\PublicStream::stream_open" call failed in docroot/modules/contrib/filehash/src/FileHash.php line 257 (Drupal\Core\Entity\EntityStorageException)
I could not fix it locally, but I'm guessing the origin of the issue is a missing validation when a file doesn't exist.
- πΊπΈUnited States mfb San Francisco
Filehash module intentionally allows the PHP warning to be logged when a nonexistant or unreadable file is hashed. In fact, we have a test that ensures this PHP warning is logged.
So, if you write a test that involves filehash hashing a nonexistent file then it should also expect a PHP warning.
I am thinking perhaps Filehash module should log its own warning in this case rather than relying on the PHP warning?
- πΊπΈUnited States mfb San Francisco
A complicating factor here is that there are some remote files, e.g. HTTP URLs, that can be hashed, but we cannot actually determine whether or not the file exists, or is readable. So, I'm not sure what the best solution is here, but the easiest solution, for me, is to simply rely on the PHP warnings.
- πΊπΈUnited States mfb San Francisco
As far as non-existent files go, it seems best to treat this as a duplicate of β¨ Allow disabling of automatic hash generation when files are loaded Fixed - sites probably won't run into this warning if they disable automatic hashing when loading files.
- πΊπΈUnited States mfb San Francisco
I also filed a feature request to allow the warnings to be suppressed: β¨ Allow warnings re: nonexistent/unreadable files to be suppressed Fixed
- Status changed to Closed: cannot reproduce
about 1 year ago 6:45pm 29 August 2023 - πΊπΈUnited States mfb San Francisco
I could not reproduce the issue reported by @yellowpomelo - and it's been a month - so I'll close this for now but feel free to re-open if you have more info