Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ricomoorman

    (@ricomoorman)

    @longnguyen , switching from “currency” to “number” helped a lot :-). The original developer of the theme in question set an invalid field type. It seems that the newest version is just not as forgiving as version 5.2.10.

    Thank you very much for your help and keep up the good work!

    • This reply was modified 4 years, 9 months ago by ricomoorman.
    Thread Starter ricomoorman

    (@ricomoorman)

    We create a bunch of meta box instances like this:

    
    $meta_boxes = array(
        0 => array(
            'id' => 'product',
            'title' => 'Product information',
            'pages' => array(
                0 => 'example_product',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                0 => array(
                    'name' => 'price',
                    'desc' => 'example: 19,95',
                    'id' => '_product_price',
                    'type' => 'currency',
                    'std' => '0',
                ),
                1 => array(
                    'name' => 'subtext',
                    'desc' => 'example: now instead of € 39,95 you only pay',
                    'id' => '_product_sidenote',
                    'type' => 'text',
                    'std' => '0',
                ),
                2 => array(
                    'name' => '',
                    'desc' => 'Product information (e.g. a discount). Not orderable directly',
                    'id' => '_product_information',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
                3 => array(
                    'name' => 'Supply',
                    'desc' => '',
                    'id' => '_product_supply',
                    'type' => 'text',
                    'std' => '0',
                ),
                4 => array(
                    'name' => '',
                    'desc' => 'Unlimited amount?',
                    'id' => '_product_supply_infinite',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
                5 => array(
                    'name' => 'Max. order amount',
                    'desc' => '',
                    'id' => '_product_max_per_order',
                    'type' => 'text',
                    'std' => '0',
                ),
                6 => array(
                    'name' => 'Date',
                    'desc' => 'E.g. for an event',
                    'id' => '_product_date',
                    'type' => 'date',
                ),
                7 => array(
                    'name' => 'Waitinglist',
                    'desc' => 'In case there are waiting list spots available',
                    'id' => '_product_waitinglist',
                    'type' => 'text',
                    'std' => '0',
                ),
            ),
        ),
        1 => array(
            'id' => 'options',
            'title' => 'Options',
            'pages' => array(
                0 => 'example_product',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                0 => array(
                    'name' => '',
                    'desc' => 'This product can be collected at the store (store can be selected when ordering)',
                    'id' => '_product_select-dealer',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
                1 => array(
                    'name' => '',
                    'desc' => 'Product is visible',
                    'id' => '_product_visible',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
                2 => array(
                    'name' => 'Starting date',
                    'desc' => 'When the product will be orderable',
                    'id' => '_product_startdate',
                    'type' => 'date',
                    'std' => '',
                ),
                3 => array(
                    'name' => 'Eind datum',
                    'desc' => 'When the product will not be orderable anymore',
                    'id' => '_product_enddate',
                    'type' => 'date',
                    'std' => '',
                ),
                4 => array(
                    'name' => '',
                    'desc' => 'Product of the month?',
                    'id' => '_product_product-of-the-month',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
                5 => array(
                    'name' => '',
                    'desc' => 'Visible on homepage?',
                    'id' => '_product_homepage',
                    'type' => 'checkbox',
                    'std' => '0',
                ),
            ),
        ),
        2 => array(
            'id' => 'email',
            'title' => 'Confirmation e-mail',
            'pages' => array(
                0 => 'example_product',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                0 => array(
                    'name' => '',
                    'desc' => '',
                    'id' => '_product_confirmation-email',
                    'type' => 'wysiwyg',
                    'std' => 'Dear member,
    
    Thank you for your order:
    [COUNT] x [PRODUCT]
    
    Best regards
    
    example.com',
                    'teeny' => true,
                ),
            ),
        ),
        3 => array(
            'id' => 'form',
            'title' => 'Form',
            'pages' => array(
                0 => 'example_product',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                0 => array(
                    'name' => 'Form',
                    'desc' => 'Select an additional form that has to be filled in',
                    'id' => '_product_extra-form',
                    'type' => 'select',
                    'options' => array(
                        0 => '',
                    ),
                    'std' => '',
                ),
            ),
        ),
        4 => array(
            'id' => 'summary',
            'title' => 'Summary',
            'pages' => array(
                0 => 'example_product',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                0 => array(
                    'name' => '',
                    'desc' => '',
                    'id' => '_product_summary',
                    'type' => 'wysiwyg',
                    'std' => '',
                    'teeny' => true,
                    'rows' => 5,
                ),
            ),
        ),
    );
    
    foreach ($meta_boxes as $meta_box) {
        if ($meta_box['id'] == 'form') {
            add_action("rwmb_after_{$meta_box['id']}", 'add_meta_export_button');
        } else {
            add_action("rwmb_after_{$meta_box['id']}", 'add_meta_save_button');
        }
    
        new RW_Meta_Box($meta_box);
    }
    

    Within admin_init … of course a lot of other things are going on in there too so I only posted the sections that seem relevant for the meta box plugin. In case you are wondering why there are numerical indexes within the array, I just did a var_export($meta_boxes) to get the result of the things going on/building the meta boxes array in the init function.

    Please let me know if there is anything else I need to provide!

    • This reply was modified 4 years, 9 months ago by ricomoorman.

    Oh I see this is still not fixed … the new version of our patch is

    --- ../wordpress/wp-includes/cache.php.old  2007-09-26 08:03:39.000000000 +0200
    +++ ../wordpress/wp-includes/cache.php  2007-09-26 08:03:06.000000000 +0200
    @@ -122,6 +122,10 @@
            if (empty ($group))
                $group = 'default';
    
    +        if (!is_string($id) || !is_numeric($id)) {
    +            return false;
    +        }
    +
            if (isset ($this->cache[$group][$id])) {
                if ($count_hits)
                    $this->warm_cache_hits += 1;

    could someone please fix this?! its really a problem out there…

    take a peek!

    https://www.google.com/search?q=Warning+illegal+offset+type+wp-includes%2Fcache.php+on+line

    This really is not solved!

    The problem is not being caused by the Zend optimizer, apache or the PHP whatsoever. It’s simply being caused by functions not taking care of what to supply to the WP_Object_Cache->get() method.

    In my case I was just trying to resolve the categories for a given post. Tracking the problem down I found that somehow the function
    “update_post_category_cache()” (functions.php:640) caused the trouble.

    This one is trying to get the category information for each category found for the post (line 667-668).

    It happens under certain circumstances the WP_Object_Cache->get() method is called with an object instead of a string or an integer value as $id to cache.

    My fix was to apply a correct check to the WP_Object_Cache->get() method:

    --- ../wordpress/wp-includes/cache.php.old  2007-07-04 08:03:39.000000000 +0200
    +++ ../wordpress/wp-includes/cache.php  2007-07-04 08:03:06.000000000 +0200
    @@ -122,6 +122,10 @@
            if (empty ($group))
                $group = 'default';
    
    +        if (!is_string($id) || !is_numeric($id)) {
    +            return false;
    +        }
    +
            if (isset ($this->cache[$group][$id])) {
                if ($count_hits)
                    $this->warm_cache_hits += 1;

    BUT I really think this should be fixed within the calling logic too in order to handle this kind of “caching” correctly.

Viewing 5 replies - 1 through 5 (of 5 total)