Strict warning: Declaration of FeedsDateTime::setTimezone() should be compatible with that of DateTime::setTimezone() in [..].

Apparently PHP doesn't like you to add extra arguments.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ickx17’s picture

Same error:

Strict warning: Declaration of FeedsDateTime::setTimezone() should be compatible with that of DateTime::setTimezone() in _registry_check_code() (line 2789 of [my_base_path]\includes\bootstrap.inc).

Don't know how to fix, please help!

datorres’s picture

I have the same error.

Strict warning: Declaration of FeedsDateTime::setTimezone() should be compatible with that of DateTime::setTimezone() en _registry_check_code() (línea 2789 de C:\xampp\htdocs\prueba\includes\bootstrap.inc).

sonar_un’s picture

Subscribing

casey’s picture

It doesn't look like the $force parameter is being used. So maybe it can be dropped.

If not, I reckon an extra method like forceTimeZone() could help out.

softmax’s picture

Subscribing

steinmb’s picture

See the same warning, PHP 5.3.5. So what is the history behind $force? Changing line 600 (plugins/FeedsParser.inc) to
public function setTimezone(DateTimeZone $tz) {
remove the warning.

milesw’s picture

The solution seems to be removing the type hint from the method signature. This doesn't really make sense, but it's how others are handling the issue.

Date module: #953688: Strict warning: Declaration of DateObject::setTimezone() ...
Joomla issue queue: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&...

public function setTimezone(DateTimeZone $tz, $force = FALSE)
changed to
public function setTimezone($tz, $force = FALSE)

Dave Reid’s picture

Status: Active » Needs work

The problem is that DateTime::setTimezone does not have a $force parameter, and therefore we can't just add an extra one when we want to if we're extending that class.

milesw’s picture

@Dave Reid

But that's the obvious solution, the one that makes sense. :)

On my system, running PHP 5.3.5, removing that $force parameter changes nothing. The only way I can get rid of the warning is to remove the DateTimeZone hint. I have no idea why, but it looks like the folks over at the Date module had to do the same.

lelizondo’s picture

subscribing.

Glottus’s picture

Subscribing

Dave Reid’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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