- 🇩🇪Germany Anybody Porta Westfalica
3.x is now 4.x - could someone please check, if the issue still exists with PHP >=8.0?
@abhijityadav?
- 🇸🇪Sweden adamevertsson
I just started using Photoswipe and yes, the error is there, filling the log.
Warning: file_get_contents(/Applications/XAMPP/xamppfiles/htdocs/web/adamevertsson.se/web/libraries/photoswipe/photoswipe.json): Failed to open stream: No such file or directory in photoswipe_library_info_alter() (line 120 of /Applications/XAMPP/xamppfiles/htdocs/web/adamevertsson.se/web/modules/contrib/photoswipe/photoswipe.module)
PHP: 8.1.17
Drupal: 10.1.4 - Assigned to Grevil
- Status changed to Active
about 1 year ago 1:06pm 25 September 2023 - 🇩🇪Germany Anybody Porta Westfalica
@AdamEvertsson and @Weres what's the correct folder structure in your case, if
/Applications/XAMPP/xamppfiles/htdocs/web/libraries/photoswipe/photoswipe.json
is wrong?
Where can we find the photoswipe.json in your case?Let's first fix this in 5.x and afterwards in 4.x
- 🇩🇪Germany Grevil
@AdamEvertsson and @Weres please take a closer look at the versions on the site! My guess is, your composer.json doesn't contain
minimum-stability": "beta"
and therefore, composer will automatically require photoswipe v4 (because photoswipe v5 is still in beta), but you are following the installation instructions for photoswipe 5, which causes the issue:I do not have a photoswipe.json file in my libraries folder. I followed the instructions for manual installation:
- Download the "PhotoSwipe-5.3.8" zip file
That's why Photoswipe 5 doesn't have a photoswipe.json.
- 🇩🇪Germany Grevil
Though I understand your troubles, as you wouldn't expect the first installation instruction on the module page to be a beta release (although photoswipe 5 is pretty much stable).
But thanks to you guys I found a message issue!
- Assigned to Anybody
- Status changed to Needs review
about 1 year ago 9:51am 27 September 2023 - @grevil opened merge request.
- 🇩🇪Germany Grevil
Adjusted the status report message for 5.x. Please review.
For everyone else running into this issue, either enable
minimum-stability": "beta"
in your composer.json and require the photoswipe 5 module OR follow the "Photoswipe 4 library installation" on the module page.I'll update the page text, so it will be more obvious.
- Assigned to Grevil
- Status changed to Needs work
about 1 year ago 10:01am 27 September 2023 - 🇩🇪Germany Anybody Porta Westfalica
Nice one @Grevil! Left some final comments. Afterwards we should merge this into dev and ask the others here, if the message appears for them and (indirectly) solves the issue.
- Status changed to Needs review
about 1 year ago 10:11am 27 September 2023 - 🇩🇪Germany Grevil
Afterwards we should merge this into dev and ask the others here, if the message appears for them and (indirectly) solves the issue.
No, this won't fix their issue, as the changes were not done in 4.x. 4.x is minimally maintained, and I don't see, that such an issue would be important enough. If you disagree, I can create another branch and make a different implementation for 4.x.
Resolved your comments. Please ignore the failing pipeline in https://git.drupalcode.org/project/photoswipe/-/pipelines/24170. Since the switch to Gitlab CI, @dinazaur's custom "drupalci.yml" doesn't apply anymore.
- 🇩🇪Germany Anybody Porta Westfalica
- Issue was unassigned.
- Status changed to Postponed: needs info
about 1 year ago 10:15am 27 September 2023 - 🇦🇹Austria agoradesign
After updating from beta1 to rc1 I see errors on the status report page:
"Photoswipe v5 currently only supports photoswipe library version minimum: 5.2.1
You need to install a compatible version!"Indeed I've the latest Photoswipe 5.4.1 (and $library_version is indeed "5.4.1")
On looking at the latest commit (https://git.drupalcode.org/project/photoswipe/-/commit/99ea723a66fc90e10...), I see that the version_compare() was changed, from:
if (version_compare($library_version, $min_req_version, '<')) {
to
if (version_compare($library_version, $min_req_version) >= 0) {
And this checks the opposite of what we want. see example 1 here: https://www.php.net/manual/en/function.version-compare.php
Proposed resolution
Revert the concerning line to
if (version_compare($library_version, $min_req_version, '<')) {
- 🇩🇪Germany Anybody Porta Westfalica
Thanks @agoradesign we had a discussion about that line before :D We'll take a look soon and fix it! Thanks!
(But it's unrelated to this issue)
- 🇦🇹Austria agoradesign
you're welcome... yeah, I know - but I felt it's ok to leave a comment here about this tiny problem. at least it was caused by this issue's commit :D
- Assigned to Grevil
- Status changed to Needs work
about 1 year ago 1:55pm 28 September 2023 - 🇩🇪Germany Anybody Porta Westfalica
Sorry YES my fault! I thought it was a different issue where it happened! Then it's right here!
@Grevil: Please resolve by reverting that line. - Issue was unassigned.
- Status changed to Fixed
about 1 year ago 7:00am 29 September 2023 - 🇩🇪Germany Grevil
Thanks, @agoradesign! Indeed, an unwise change, my apologies.
- 🇦🇹Austria agoradesign
Such things may happen... version_compare() can be quite confusing to read
Automatically closed - issue fixed for 2 weeks with no activity.