marcbelletre/acf-rrule

Arrays returned as string

taenzerme opened this issue · 2 comments

Hey there,

I'm trying to get this to work, but when retrieving the value all arrays are strings ("Array"):

["dates_collection"]=> string(5) "Array"

Inside load_value() all the data is there, but when querying get_field('repeat', $event->ID) inside a template file results in all arrays beeing converted.

Before looking into my own setup: Is this maybe a known issue with latest ACF/ACFP versions?

Thanks!

Sebastian

Hi @taenzerme,

This is weird, I just tested with a fresh Wordpress installation and a very basic configuration and I can't reproduce the bug you're reporting.

Here's what I did:

  1. Install a fresh Wordpress
  2. Install ACF & ACF RRule plugins
  3. Add a field group to the Post type with a single RRule field
  4. Create a post with a recurring rule
  5. In a custom theme, write the following code in the single-post.php template (or any other that works with a single post)
<?php get_header(); ?>

<?php
while (have_posts()) : the_post();

    echo '<pre>';
    var_dump(get_field('rrule'));
    echo '</pre>';

endwhile;
?>

<?php get_footer(); ?>

I get the values I'm looking for:

  ["dates_collection"]=>
  array(22) {
    [0]=>
    object(DateTime)#6068 (3) {
      ["date"]=>
      string(26) "2022-11-01 00:00:00.000000"
      ["timezone_type"]=>
      int(3)
      ["timezone"]=>
      string(3) "UTC"
    }
    [1]=>
    object(DateTime)#6078 (3) {
      ["date"]=>
      string(26) "2022-11-02 00:00:00.000000"
      ["timezone_type"]=>
      int(3)
      ["timezone"]=>
      string(3) "UTC"
    }
    ...
  }

I suspect there is something conflicting in your own implementation. Could you please send a sample that could help me find out what's going on?

Hey Marc, thanks for the response! I suspected as such. Will send you samples later. But I guess it's really something weird with my clients site setup. Will try a clean setup first before creating too much work.