Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | 1055582-strict-warning-for-feedsdatetime-settimezone-7-D7.patch | 1014 bytes | milesw |
Comments
Comment #1
ickx17 CreditAttribution: ickx17 commentedSame 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!
Comment #2
datorres CreditAttribution: datorres commentedI 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).
Comment #3
sonar_un CreditAttribution: sonar_un commentedSubscribing
Comment #4
casey CreditAttribution: casey commentedIt 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.
Comment #5
softmax CreditAttribution: softmax commentedSubscribing
Comment #6
steinmb CreditAttribution: steinmb commentedSee 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.
Comment #7
milesw CreditAttribution: milesw commentedThe 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)
Comment #8
Dave ReidThe 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.
Comment #9
milesw CreditAttribution: milesw commented@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.
Comment #10
lelizondo CreditAttribution: lelizondo commentedsubscribing.
Comment #11
Glottus CreditAttribution: Glottus commentedSubscribing
Comment #12
Dave ReidConfirmed. Fix applied to 7.x-2.x and 6.x-2.x.
http://drupalcode.org/project/feeds.git/commit/76a72d0
http://drupalcode.org/project/feeds.git/commit/896d12a