Return value must be of type string, null returned

Created on 11 July 2023, over 1 year ago
Updated 1 March 2024, 9 months ago

Problem/Motivation

TypeError: Drupal\auditfiles\Services\AuditFilesConfig::getReportOptionsDateFormat(): Return value must be of type string, null returned in Drupal\auditfiles\Services\AuditFilesConfig->getReportOptionsDateFormat() (line 68 of modules/contrib/auditfiles/src/Services/AuditFilesConfig.php).

TypeError: Drupal\auditfiles\Services\AuditFilesConfig::getFileSystemPath(): Return value must be of type string, null returned in Drupal\auditfiles\Services\AuditFilesConfig->getFileSystemPath() (line 30 of modules/contrib/auditfiles/src/Services/AuditFilesConfig.php).

Steps to reproduce

  1. Upgrade to D10
  2. Goto /admin/reports/auditfiles/mergefilereferences
  3. Goto /admin/reports/auditfiles/managednotused

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

4.1

Component

Code

Created by

🇵🇭Philippines _renify_ cebu

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

Comments & Activities

  • Issue created by @_renify_
  • Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • @_renify_ opened merge request.
  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia dpi Perth, Australia
    1. +++ b/src/Form/AuditFilesManagedNotUsedForm.php
      @@ -139,7 +139,10 @@ final class AuditFilesManagedNotUsedForm extends FormBase implements AuditFilesA
      +    if (count($rows) > 0)  {
      

      This is an irrelevant change.

      In any case instead $rows should be put at the top of the function instead of doing this empty check.

      Create a new issue.

    2. +++ b/src/Services/AuditFilesConfig.php
      @@ -65,7 +66,8 @@ final class AuditFilesConfig implements AuditFilesConfigInterface {
      +    return $auditfiles_report_options_date_format ? $auditfiles_report_options_date_format : '';
      

      This value should never be null, if the module is installed fresh this wont happen. Theres a chance that evolution of the module fixed a possible null.

      Instead of the proposed change, I'd accept a hook update to fix this value so it is forced to a string.

  • 🇦🇺Australia edyuenyw

    I can verify that I had the same problem but a simple re-install of the module fixes it.
    My auditfiles.settings only had one line and throwing NULL errors but reinstalling the module added more settings.

  • 🇮🇳India dineshkumarbollu

    I checked in my system didn't encountered any issue in /admin/reports/auditfiles/mergefilereferences

Production build 0.71.5 2024