• Resolved Kin36

    (@kin36)


    Hello, I have installed the plugin on Worpress 5.6 (xaamp) using Pro Theme and I’m getting this error when I use the shortcode:

    Warning: Illegal offset type in … wp-opening-hours\classes\OpeningHours\Module\OpeningHours.php on line 114

    Is my version of php too old? Or too young? ??
    PHP: 7.2.1

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author janizde

    (@janizde)

    Hi Kin,

    it would be rather too young than too old ?? The most part of the current version was written in PHP5 times (it currently actually supports PHP5.2 still). Though, the unit tests actually run up to PHP7.3 and I’ve never seen this error there.

    I will take a look on the weekend

    Cheers
    Jannik

    Plugin Author janizde

    (@janizde)

    Hey Kin,

    following up on this, I had a look and I don’t think it’s a PHP compatibility issue. It seems that OpeningHours::getSet($id) is invoked with an array or object. Is there any more information like a strack trace you could provide (usually it would print it with the error so you know who called OpeningHours::getSet)?

    Cheers
    Jannik

    Thread Starter Kin36

    (@kin36)

    Hey Janizde, thank you for spending time helping us users out!

    The only thing I can add to my previous message is that the error occured in OpeningHours.php on line 114. This is the only bit of information that is printed on screen, unfortunatly I cannot give you the adress of the websites I’m trying your plugin on since it is xaamp project.

    If I can do something more to help ypu out let me know.

    Thanks

    Kin

    Thread Starter Kin36

    (@kin36)

    Found the problem!

    When generating a shortcode the id of the same is missing, therefore php goes into error. It was a trivial mistake but I didn’t notice it until yesterday.

    • This reply was modified 3 years, 11 months ago by Kin36.
    Plugin Author janizde

    (@janizde)

    Hi @kin36 ,

    nice that the error surfaced! So you just didn’t specify a set_id in the shortcode? Did you generate the shortcode with the Shortcode Builder (https://janizde.github.io/opening-hours-shortcode-builder/) ? I think it would be a nice improvement to throw a more descriptive error in these cases since it might not be obvious that this is mandatory.

    Have a nice holiday season
    Jannik

    Thread Starter Kin36

    (@kin36)

    Hi!

    Yes, I used the Shortcode Builder. As soon as the default shortcode “Overview” is generated, the shortcode actually includes the Id. But if you switch to another type of visualization (eg “Is Open”) the output is without it.

    Like:
    [op-overview set_id = “46”]

    -changes to –

    [op-is-open]

    I wish you happy holidays
    Kin

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Warning: Illegal offset type in…’ is closed to new replies.