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.
I'm getting
Warning: time() expects exactly 0 parameters, 2 given in /var/www/drupal/web/core/lib/Drupal/Core/Field/BaseFieldDefinition.php on line 469
I Found
In "Vote.php" the callback for the BaseFieldDefinition "timestamp" is:
->setDefaultValueCallback('time');
I propose
->setDefaultValueCallback(static::class . '::getRequestTime');
and then
public static function getRequestTime() {
return \Drupal::time()->getRequestTime();
}
Comment | File | Size | Author |
---|---|---|---|
#4 | votingapi-timecallback-3048085-1-4.patch | 607 bytes | ndrake86 |
Comments
Comment #2
devitate CreditAttribution: devitate as a volunteer commentedComment #3
ndrake86 CreditAttribution: ndrake86 at Workday, Inc. commentedConfirming this is an issue w/ any PHP 7.3 based site. The question I have is, is the callback even needed here, "created" is a default provided by core.
Comment #4
ndrake86 CreditAttribution: ndrake86 at Workday, Inc. commentedWonder what the test bot says
Comment #5
devitate CreditAttribution: devitate as a volunteer commentedI have to agree, I was tripped up by the field name "timeline" or maybe that I was looking at the "media" module which gets creative with "created".
Every other entity works just fine with:
Comment #6
ndrake86 CreditAttribution: ndrake86 at Workday, Inc. commented@devitate If you can test this (or if you already have can we move this to RTBC so that we might be the maintainer to take a look.
Comment #7
devitate CreditAttribution: devitate as a volunteer commentedI get no issues using either patch w/php7.3, so if we're certain that
BaseFieldDefinition::create('created')
is the equivalent core default then I see no issue, unless "Voting API" has some other reason for using special callback(s).Comment #8
ndrake86 CreditAttribution: ndrake86 at Workday, Inc. commentedI don't see anything special going on here with the timestamp, either solution should work; if there is a need to do something custom the first approach is the right way to go but I'm not seeing that. Hopefully we can get a maintainer to take a look. Moving to RTBC based on the testbot and the previous comment.
Comment #9
pifagorHello everyone.
Soon I'm looking at the patch.
Comment #10
pifagorComment #11
alex_optimLooks good.
Comment #12
pifagorComment #14
pifagorComment #15
frmcclurg CreditAttribution: frmcclurg commentedI applied patch "votingapi-timecallback-3048085-1-8.6.patch" and it appears to eliminate the warning message. I am using PHP 7.3.5 Thanks for your help!
Comment #16
destinationsound CreditAttribution: destinationsound commentedThis error also happening in the beta version. This fixed it. Should also be included in the non-dev
Comment #17
Frank Panduh CreditAttribution: Frank Panduh as a volunteer commentedPatch Confirmed working on 7.3.
Screenshot Of Patch