Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed with reserved slots from content type doesn't work in PHP 8.x #23

Closed
olafgrabienski opened this issue Apr 3, 2023 · 5 comments
Closed

Comments

@olafgrabienski
Copy link
Member

olafgrabienski commented Apr 3, 2023

On PHP 8.x, when I create content of type A, the 'additional reserved slots' [*] from content type B don't shop up.

Steps to reproduce

  • Install the modules Resource Timeslots, and Views JSON.
  • Add a content type called "Room".
  • Add a content type called "Booking", add a Resource timeslot field, and select "Room" as Resource content type.
  • Add a content type called "Reservation", add a (new) Resource timeslot field, and select again "Room" as Resource content type.
  • Add a "Booking feed" view.
    • Format: JSON data document; changed settings:
      • Root object name: (empty)
      • Top-level child object: (empty)
      • Numeric strings. Encodes numeric strings as numbers. (enabled)
    • Fields:
      • field_booking_room:start
      • field_booking_room:end
      • Custom text; Label: display, Text: background
    • Filter criteria:
      • Published = Yes
      • Type = Booking
      • Room:start (not empty)
    • Sort criteria: (none)
    • Path: booking-feed
    • Contextual filters:
      • field_booking_room:resource_id
        • Provide default value > Raw value from URL, Path component: 1
        • Specify validation criteria: Numeric
  • Edit the Resource timeslot field of the Reservation content type, and add the following URL for additional reserved slots: /booking-feed/{ID}
  • Create a Room item (Add content > Room).
  • Create some Booking items for the new Room.
  • Create a Reservation item.

Expected behavior: In the calendar of the Reservation item, there are Booking items provided by the Booking feed view.

Actual behavior: There are no Booking items.

PHP version: 8.0.28 (same with 8.1.16)

When I switch PHP to version 7.4.33, everything works as expected.


[*]: Reserve slots with a JSON feed (Wiki page)

@indigoxela
Copy link
Member

Format: JSON data document;

Ah, this might be the culprit, while we discussed in our Zulip chat, I used the "Fullcalendar JSON" format, which ships with this module, but you seem to use a json feed created by another module (views_json).
At least, we found a difference in our testing setup.

@indigoxela
Copy link
Member

Re the views_json setup I need more info, as the setup has several pitfalls. Can't seem to login into your dev anymore (you probably reset the db, so my user won't work anymore).

@indigoxela
Copy link
Member

indigoxela commented Apr 4, 2023

After some experiments, it turns out that views_json is the culprit. In PHP 7.x the "Numeric strings -
Encodes numeric strings as numbers." setting does its job, but in PHP 8.x the item remains a string. In which case FullCalendar doesn't accept the (string) timestamp as date format.

Tricky: this only happens with the real json feed url, but in the preview the timestamps are still numeric. 🙄 Very hard to find.

@indigoxela
Copy link
Member

The latest release of views_json fixes the issue.

@olafgrabienski
Copy link
Member Author

olafgrabienski commented Apr 4, 2023

The latest release of views_json fixes the issue.

Confirmed. I've just updated that module on my test site, and the issue is fixed. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants