Fix PHP Fatal error: Cannot redeclare varbase_media_requirements() previously declared when installed with Drush ~12 and PHP 8.3

Created on 8 January 2024, over 1 year ago
Updated 16 April 2024, about 1 year ago

Problem/Motivation

Having the following in PHP 8.1

in the varbase_media.install

// Include all helpers and updates.
include_once __DIR__ . '/includes/helpers.inc';
include_once __DIR__ . '/includes/updates.inc';

and in the varbase_media.module

// Include all helpers.
include_once __DIR__ . '/includes/helpers.inc';

// Include Varbase Media global tokens.
include_once __DIR__ . '/varbase_media.tokens.inc';

When updating to PHP 8.3
and when installing with Drush ~12

[Mon Jan 08 14:21:07.510983 2024] [php:error] [pid 108041] [client 10.50.111.41:54342] PHP Fatal error:  Cannot redeclare varbase_media_requirements() (previously declared in /var/www/html/products/varbase_media/includes/helpers.inc:16) in /var/www/html/dev/varbase10c1/docroot/modules/contrib/varbase_media/includes/helpers.inc on line 40

Proposed resolution

  • Move the varbase_media_requirements function to from /includes/helpers.inc to varbase_media.install

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-10.0.0-rc2 , varbase-9.0.18 , varbase_media-9.0.41 , Varbase 9.1.1 , varbase_media-9.1.5 , varbase_media-10.0.0-rc1

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3413168 : Fixed PHP Fatal error: Cannot redeclare varbase_media_requirements() previously declared when installed with Drush ~12 and PHP 8.3
🐛 Bug report
Status

Fixed

Version

10.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024