search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

PHP 8.1 support

Asked by Mr. Bigg
1 year ago.

Daypilot won't display events on Scheduler, json response look likes ok.

only difference in json response: php 8.0 = "id":"12", php 8.1 = "id":12

manipulated json response with preg_replace: php 8.0 = "id":"12", php 8.1 = "id":"12"

the same, events are not displayed in the scheduler

No PHP warning or error, No JavaScript warning or error, No AJAX warning or error,...

Answer posted by Dan Letecky [DayPilot]
1 year ago.

In the Scheduler, events will only be displayed if the "resource" property value of an event matches the row id as specified in "resources" array, "id" property.

The values need to match exactly, i.e. "1" (string) is different from 1 (number).

So I recommend checking both data sources (events and resources) to see if the values are correct.

Comment posted by Mr. Bigg
1 year ago.

Thanks, if I manipulate both (events and resource) json response with preg_replace (PHP 8.1: "id":12 -> "id":"12" ) the scheduler shows all events.

Comment posted by Dan Letecky [DayPilot]
1 year ago.

Great, thanks for the update.

Instead of using regex to update the json, it would be better to convert the source values (e.g. the resource id) to string/int as needed [strval()/intval()].

And even better, make sure that the database fields have the correct type. PHP used to convert int values to string when loading data from a database (e.g. MySQL with PDO). This might be what has changed in version 8.1.

Comment posted by Mr. Bigg
1 year ago.

Thanks for the help, strval is much better. Why didn't I think of that...

I also think this was changed in PHP 8.1.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.