Drupal 11.2.2. PHP 8.4:
In PHP 8.4 nullable values in functions has changed.
One example (modules\contrib\backup_migrate\src\Entity\WrapperEntityBase.php):
public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
Should be:
public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
OR
public function access($operation, AccountInterface|null $account = NULL, $return_as_object = FALSE) {
My site has found this location (and similar locations in other modules), and perhaps it also occurs elsewhere in backup_migrate?
Issue fork backup_migrate-3534121
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
Comment #2
danrodComment #3
danrodI see it in other files as well:
More:
Deprecated function: Method mysqli::ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this method is now redundant in Drupal\backup_migrate\Core\Source\MySQLiSource->_getConnection() (line 194 of modules/contrib/backup_migrate/src/Core/Source/MySQLiSource.php).And the one that you reported:
Comment #4
danrodComment #6
danrodI pushed some changes to fix these PHP 8.4 deprecations issues, as for this warning:
Deprecated function: Method mysqli::ping() is deprecated since 8.4, because the reconnect feature has been removed in PHP 8.2 and this method is now redundant in Drupal\backup_migrate\Core\Source\MySQLiSource->_getConnection() (line 194 of modules/contrib/backup_migrate/src/Core/Source/MySQLiSource.php).I looked at the official PHP documentation but it is not clear to how to replace it:
Maybe using mysqli_ping() is not really needed at all.
I removed the call to
!$this->connection->ping()and rely on$this->connection->connect_errnoto check if there's an error connecting to the MySQL server, if anyone has a better idea, please let me know, I'll move it to "Needs Review" for now.Comment #7
danrodComment #8
danrodComment #9
samuhe commentedThe changes fix the deprecation warnings.
As for the ping function, it indeed seems to be redundant and just removing it seems fine to me.
Comment #10
danrodI think we can move this to "Fixed" and push this change to the 5.1.x branch, I'll do some testing before doing that.
Comment #12
ivnishThanks! Fixed
Comment #14
solideogloria commentedThanks! Looking forward to a release containing the fixes.
Comment #15
solideogloria commented