When I edit a node and set an exception to the date repeating, and infinite loop occurs. Running Drupal 5.7, PHP 5.2.5, date field, jscalendar, UTC timezone for everything required.

CommentFileSizeAuthor
#22 date-bug.rar_.tar_.gz901.42 KBpkej
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jscheel’s picture

Sorry, that last piece was "...UTC for everything, field is required".

KarenS’s picture

Everything works fine as long as you don't try to set an exception date, right? I was just running into this, too. Exception dates used to work fine, but something has changed somewhere and I need to track it down.

KarenS’s picture

Status: Active » Postponed (maintainer needs more info)

Try again with the latest cvs. I just make a fix to the date popup module that seems to have fixed this, too.

jscheel’s picture

Status: Postponed (maintainer needs more info) » Active

Note: this works fine on my local dev environment, but the bug appears on the live server. Both are running the same versions of everything, except mysql on local is 5.0.45 and on live is 5.0.22. I also noticed that the dates get saved without the "T" on my local environment but they have the "T" on the live server. Both dev and live are on same timezone as well.

jscheel’s picture

Hmm, grabbed latest version, but now I'm getting a WSOD. "Only variables can be passed by reference in ../sites/all/modules/date/date_copy/date_copy.module on line 193"

jscheel’s picture

Just to test, I pushed just the date_popup.module fix (to get around the WSOD), but it is still ending in an infinite loop.

jscheel’s picture

Interestingly, when I set the widget to use select list instead of the jquery popup, the date repeating fields still used the jquery popup.

KarenS’s picture

Date copy module? There is no reason Date Copy would be doing anything here. I can't replicate this at all.

KarenS’s picture

#7 is not a bug, it's by design for now and there's an issue about matching the date repeat widget to the date select widget, so that's not a part of this issue.

KarenS’s picture

Line 193 of Date Copy is not passing a reference -- it's a form element that should only show up at admin/content/date or admin/content/date/import (the Date Import/Export paths). There is no other place that would be called, definitely not from a date repeat widget. Are you sure you've got the right code?

jscheel’s picture

Oh, I'm a retard. I'm checking out trunk, which is probably your 6.x development. Sorry! Let me try the right branch :P

jscheel’s picture

Alright, I'm using the lastest from the 5.x branch. Now I'm getting this when viewing the node:

"user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (EXTRACT(MONTH FROM(node_data_field_date.field_date_value)) = ) AND (EXTRA' at line 1 query: SELECT DISTINCT(node.nid), node_data_field_date.field_date_value AS node_data_field_date_field_date_value, node.title AS node_title, node.changed AS node_changed, node_data_field_date.field_date_value2 AS node_data_field_date_field_date_value2, node_data_field_date.field_date_rrule AS node_data_field_date_field_date_rrule FROM node node LEFT JOIN content_field_date node_data_field_date ON node.vid = node_data_field_date.vid WHERE (node.status = '1') AND (node.type IN ('class')) AND (EXTRACT(YEAR FROM(node_data_field_date.field_date_value)) = ) AND (EXTRACT(MONTH FROM(node_data_field_date.field_date_value)) = ) AND (EXTRACT(DAY FROM(node_data_field_date.field_date_value)) = ) ORDER BY node_data_field_date_field_date_value ASC in /httpdocs/includes/database.mysqli.inc on line 151."

Also, adding exceptions is still causing an infinite loop.

jscheel’s picture

The sql error looks like it's happening from a view in a block on the site that uses the date filters, not from viewing the node.

KarenS’s picture

You need to find that view and pull it up and make sure it's set up right. Save it, even if it looks right. Then see if the error goes away.

jscheel’s picture

Hmm same sql error. Also still getting the infinite loop on the date exceptions. I know this is a separate issue, but just for the record, here is my view that is getting a sql error:

  $view = new stdClass();
  $view->name = 'classes_embed_today';
  $view->description = 'Schedule of today\'s fitness classes for embedding (since calendar breaks args)';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = '';
  $view->page_header = '';
  $view->page_header_format = '4';
  $view->page_footer = '';
  $view->page_footer_format = '4';
  $view->page_empty = '';
  $view->page_empty_format = '4';
  $view->page_type = 'list';
  $view->url = 'classes_embed_today';
  $view->use_pager = FALSE;
  $view->nodes_per_page = '0';
  $view->sort = array (
    array (
      'tablename' => 'node_data_field_date',
      'field' => 'field_date_value',
      'sortorder' => 'ASC',
      'options' => '',
    ),
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array (
      'tablename' => 'node_data_field_date',
      'field' => 'field_date_value',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'default',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'class',
),
    ),
    array (
      'tablename' => 'node_data_field_date',
      'field' => 'field_date_value_year',
      'operator' => '=',
      'options' => 'now',
      'value' => '',
    ),
    array (
      'tablename' => 'node_data_field_date',
      'field' => 'field_date_value_month',
      'operator' => '=',
      'options' => 'now',
      'value' => '',
    ),
    array (
      'tablename' => 'node_data_field_date',
      'field' => 'field_date_value_day',
      'operator' => '=',
      'options' => 'now - 6 hours',
      'value' => '',
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node_data_field_date, node);
  $views[$view->name] = $view;
KarenS’s picture

Status: Active » Postponed (maintainer needs more info)

I am absolutely unable to get any endless loop problems in the latest code. I've tried every combination of date repeat I can come up with and they all work fine. I've tried all kinds of widgets, formats, with and without timezones, etc, etc. everything works perfectly for me.

I've made commits today, so make sure you have the latest code with those commits so we're not talking apples and oranges, clear all your caches, pull up your date field, double check it's settings, and save it (even if you made no changes).

Then try again.

jscheel’s picture

Status: Postponed (maintainer needs more info) » Active

Just to test everything out, I created a fresh new site, with just CCK and Date (latest code from cvs) installed. I set the site timezone to UTC and turned off user timezones. I'm still getting the problem. I've tried changing the "to" date field from optional to never, but that didn't help. Here is an export of the content type on the test site I set up:

$content[type]  = array (
  'name' => 'class',
  'type' => 'class',
  'description' => '',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => false,
    'sticky' => false,
    'revision' => false,
  ),
  'comment' => '0',
  'old_type' => 'class',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_popup',
    'label' => 'date',
    'weight' => '0',
    'default_value' => 'blank',
    'default_value_code' => '',
    'default_value2' => 'same',
    'default_value_code2' => '',
    'input_format' => 'd/m/Y h:i:sA',
    'input_format_custom' => '',
    'year_range' => '-3:+3',
    'increment' => '1',
    'advanced' => 
    array (
      'label_position' => 'above',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => '1',
    'multiple' => 1,
    'repeat' => 1,
    'todate' => '',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'm/d/Y - g:ia',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - g:ia',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - g:ia',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y - g:ia',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'repeat_collapsed' => 0,
    'field_name' => 'field_date',
    'field_type' => 'date',
    'module' => 'date',
    'label_position' => 'above',
    'text_parts' => 
    array (
    ),
  ),
);

Thanks a lot for all of the help you are giving me KarenS :)

KarenS’s picture

Still unable to reproduce this problem. I've tried all kinds of things, including switching from PHP 5.2 to PHP 4, and never have a problem.

My only other idea is that it's related to http://drupal.org/node/273344. Try giving the date a default value of 'now' instead of blank and see if that makes any difference. Also try switching from the Date Popup to a Date Select widget. And try a couple different types of dates (an ISO date and a datestamp date) to see if that makes any difference.

Anything you can do to narrow down exactly what combination causes the problem would help.

jscheel’s picture

Will do. I'm going to be gone for the next week, but if I can get to the computer at all, I'll work on it. Thanks again for all your help!

KarenS’s picture

I was finally able to find a way to get an infinite loop, but only using PHP4 and the PHP4 wrapper code. I uncovered that problem when fixing http://drupal.org/node/272523 where I found a situation where the wrapper date_modify() function could get stuck on invalid values. I still have not been able to get this to happen using PHP 5.2.

KarenS’s picture

There was another report at http://drupal.org/node/283706. I'm still unable to reproduce this, so as much info as possible will help.

pkej’s picture

FileSize
901.42 KB

OK, here is a step by step of my problem:

Downloads:

  1. Download XAMPP 1.7.6 for Windows or Mac.
  2. Download Drupal 5.8
  3. Download CCK 5.x-1.7
  4. Download Date 5.x-2.x-dev (datestamp 1216166541)
  5. Run the install script
  6. Create the first account
  7. Set Default Time zone to +0200
  8. Set Short date format to 2008-07-17 17:01
  9. Set Medium date format to 2008, July 17 - 17:01
  10. Set Long date format to Thursday, 2008, July 17 - 17:01
  11. Set first day of week to Monday

Enable the modules:

  1. Enable "Content"
  2. Enable "DateAPI"
  3. Enable "Date Repeat API"
  4. Enable "Date Timezone"
  5. Enable "Date"
  6. Set the Timezone name to Europe/Oslo

Creating content type:

  1. Create a new content type (admin/content/types/add) Set: Name: "Booking", Type: "booking". Leave the rest unchanged.
  2. Add a field to the "Booking" (admin/content/types/booking/add_field). Set: Name: "time", Field type: "Datetime - Text field". Continue.
    It seems that I have to enable at least one core CCK field type to be able to add any fields. I selected to enable the "CCK Text" module.
  3. Set "Widget settings" Widget: "Text Field with custom input format".
  4. Set "Widget settings" Default Value: "Now"
  5. Set "Customize Default value" Default value for To date: "Now"
  6. Set "Customize Date Parts" Position of date part labels: "Within"
  7. Set "Data settings" Multiple: "Repeating", To Date: "Optional".

Create a node:

  1. Create a new node of content type "Booking".
  2. Title: "NRK Gymsal"
  3. From date: 2008-08-15 18:00
  4. To date: 2008-08-15 20:00
  5. Repeat: Every Week(s) Until: 2009 Jun 15 Except: 2008 Dec 22
  6. Body: I hope this don't work, or I have been writing down all the steps for nothing.

Well, it didn't work now, I got the following error message:

    * warning: preg_match() expects parameter 2 to be string, array given in C:\Documents and Settings\n18134\Skrivebord\xampp\htdocs\date-bug\sites\all\modules\date\date_api.module on line 944.
    * warning: preg_match() expects parameter 2 to be string, array given in C:\Documents and Settings\n18134\Skrivebord\xampp\htdocs\date-bug\sites\all\modules\date\date_api.module on line 944.

For your convinience I have added a rar archive (change the extension to .rar) of my date-bug testing. Included is the "Demo Site" module. You should just have to extract the archive into an XAMPP installation, change the settings.php file, install and enable the "Demo Site" module, then you should be able to reset site to the state it was in after I performed the above steps.

My testing seems to indicate that the timeout probably is due to one of the other "standard"-modules I use.

KarenS’s picture

pkej - this is very helpful but I can't do anything with your file. I don't know what '.rar' extensions are supposed to do but it doesn't work on my system. I'm using windows and I can handle .zip and .gz.

What makes you think your timeout is coming from some other module? Do you have any idea which one it is so I can try it?

pkej’s picture

Search for Unrar on google, or winrar. Unfortunately compressing with zip made the file slightly bigger than the upload limit of 1 MB, and on the Windows machine where I tested at work, tar and gz are not available.

Just speculating as for the infinite loop I experienced in http://drupal.org/node/283706. The reason I speculate about that is that on both my first on my Mac and my second test at work PC, I experienced the infinite loop. Both were using quite a few modules, I am trying to find an effective way to do n-m relationships where the relationships are nodes, without writing code. That's why I believe it might be the interaction with some of those other modules that might have influenced the infinite loop.

For example, could the developer modules lead to this? Or how about some of the java scripts in date module, which I didn't turn on for the above test. How about jquery_update. And on at least one of the test systems I had the event module installed as well.

I still have those installations, so I could zip them down, but we need to find an FTP site where I can upload it and where you can download, b/c they are way too big to be attached to an issue.

I'll try to load up on the modules one by one on the date-bug installation from yesterday and see if I reach the infinite loop at some point.

KarenS’s picture

Status: Active » Fixed

I did some significant work on the Date Repeat widgets, so hopefully this is fixed. You either need the current cvs -dev version, or wait until later day when I plan to roll a new rc.

pkej’s picture

Looking forward to the rc, I will do some extensive testing at that point! Thanks for the great work.

KarenS’s picture

I just tagged a new release with these fixes.

jscheel’s picture

KarenS, sorry I fell of the face of the planet with this. I'm super excited to try these new fixes!

pkej’s picture

I have had no repeat of the infinite loop after using the latest version in 6.x. I haven't gone back and tried in 5.x, been busy at work for the fall schedule.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.