Problem/Motivation

After deploying the 2.11 release, some pages begun resulting in 503 server error. I suspect those pages don't have the date field value selected, but could be something else. We use search API page which resulted in this error returning back for any keyword.

Steps to reproduce

Steps to reproduce may be specific to our environment/set up.

THe error returned is:

TypeError: Argument 7 passed to date_formatter_process() must be of the type array, null given, called in docroot/sites/all/modules/contrib/date/date.field.inc on line 205 in date_formatter_process() (line 221 of docroot/sites/all/modules/contrib/date/date.module)

Upon inspection, there was a change in the function date_formatter_process() arguments - added type, which is now causing the problem when an incorrect type was passed.

Proposed resolution

Proposing the addition of data type validation. A patch which resolved the issue on our side attached.

Issue fork date-3206507

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ivrh created an issue. See original summary.

steinmb made their first commit to this issue’s fork.

drupal-kata’s picture

We faced the same problem: Drupal 7.81, MYSQL 5.7 and PHP 7.3. We got 503 error in the views where the date field was empty. The patch worked and helped to solve the problem.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new519 bytes

Rerolled.

damienmckenna’s picture

Issue summary: View changes

I'm not sure this should be needed - $items should be an array of arrays, with each item containing an element 'value', per hook_field_formatter_view(). So I wonder if the error comes from somewhere else, or maybe some custom code that modifies the array?

damienmckenna’s picture

Status: Needs review » Postponed (maintainer needs more info)

If someone can provide some specifics on what triggers this, e.g. another module that uses date fields, or maybe some custom code, then I'm happy to work on finishing this off, but right now the module seems to work as it's supposed to.

damienmckenna’s picture

Version: 7.x-2.11 » 7.x-2.x-dev
xmacinfo’s picture

I am hitting that error updating the Date module from 7.x-2.10 to 7.x-2.14.

TypeError: Argument 7 passed to date_formatter_process() must be of the type array, null given, called in /srv/www/………/sites/all/modules/date/date.field.inc on line 215 in date_formatter_process() (line 223 of /srv/www/………/sites/all/modules/date/date.module).

We have a lot of custom code.

Not sure if I will use the patch in #8 or if I will be able to investigate the piece of code that triggers that error.

damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new519 bytes

Patch #8 wasn't compatible with PHP 5, so this might work better.

damienmckenna’s picture

StatusFileSize
new524 bytes

Never mind #13, this is what I meant.

damienmckenna’s picture

@xmacinfo: Could you please do some debugging to see if you can work out what variable is causing this?

xmacinfo’s picture

@DamienMcKenna Using your patch in #15 solves the issue.

We have a lot of custom code. I will try to find which variable is passed as an argument (argument 7). But I am not sure how much time I will be able to allow for this.