Problem/Motivation

The "max PHP version" (PHP 8.5) tests are not passing. There are many "Exception: Deprecated function: Using null as an array offset is deprecated, use an empty string instead" warnings.

Proposed resolution

Fix the "Using null" warnings and any other thing that is preventing the tests from passing.

Remaining tasks

Implement.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork webform-3590360

Command icon 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

liam morland created an issue. See original summary.

liam morland’s picture

Status: Active » Needs review

The merge request contains a bunch of fixes. There are still some "Using null as an array offset is deprecated" messages about ViewsViewsHooks->viewsData(). I think those were fixed in #3347842: Deprecate the trusted data concept in configuration; see #3563306: Views views_data hook is not entirely PHP 8.5 ready.

liam morland’s picture

  • liam morland committed c103ea6e on 6.3.x
    fix: #3590360 Avoid NULL array key in WebformOptionsCustom::...

  • liam morland committed 9e368483 on 6.3.x
    fix: #3590360 Avoid NULL array key WebformSubmission::isOwner()
    
    A...

  • liam morland committed 5ade2dbf on 6.3.x
    fix: #3590360 Avoid NULL array key in Webform::getElement()
    

  • liam morland committed 639f18aa on 6.3.x
    fix: #3590360 Avoid NULL array key in WebformAdminConfigBaseForm
    

  • liam morland committed 265c3314 on 6.3.x
    fix: #3590360 Do not call FormStateInterface::setErrorByName() with NULL...

  • liam morland committed 68866791 on 6.3.x
    fix: #3590360 Ensure $key is not NULL in Webform::getPage()
    

  • liam morland committed 81130df7 on 6.3.x
    fix: #3590360 Ensure $operation is not NULL in Webform::getPages()
    

  • liam morland committed c103ea6e on 6.x
    fix: #3590360 Avoid NULL array key in WebformOptionsCustom::...

  • liam morland committed 9e368483 on 6.x
    fix: #3590360 Avoid NULL array key WebformSubmission::isOwner()
    
    A...

  • liam morland committed 5ade2dbf on 6.x
    fix: #3590360 Avoid NULL array key in Webform::getElement()
    

  • liam morland committed 639f18aa on 6.x
    fix: #3590360 Avoid NULL array key in WebformAdminConfigBaseForm
    

  • liam morland committed 265c3314 on 6.x
    fix: #3590360 Do not call FormStateInterface::setErrorByName() with NULL...

  • liam morland committed 68866791 on 6.x
    fix: #3590360 Ensure $key is not NULL in Webform::getPage()
    

  • liam morland committed 81130df7 on 6.x
    fix: #3590360 Ensure $operation is not NULL in Webform::getPages()
    
liam morland’s picture

Status: Needs review » Active

Fixes committed; leaving open until tests pass on PHP 8.5. The rest of the fixes are likely in Drupal core; see comment #3 and #4.

flemming.fridthjof’s picture

Found two more places, within the module, where the deprecation warning is given.

Deprecated function: Using null as an array offset is deprecated, use an empty string instead in Drupal\webform\Plugin\WebformElement\OptionsBase->getElementSelectorInputValue() (line 848 of /app/platform_drupal_11_4_x/modules/contrib/webform/src/Plugin/WebformElement/OptionsBase.php) #0 /app/platform_drupal_11_4_x/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
      #1 /app/platform_drupal_11_4_x/modules/contrib/webform/src/Plugin/WebformElement/OptionsBase.php(848): _drupal_error_handler()
      #2 /app/platform_drupal_11_4_x/modules/contrib/webform/src/WebformSubmissionConditionsValidator.php(765): Drupal\webform\Plugin\WebformElement\OptionsBase->getElementSelectorInputValue()
      #3 /app/platform_drupal_11_4_x/modules/contrib/webform/src/WebformSubmissionConditionsValidator.php(735): Drupal\webform\WebformSubmissionConditionsValidator->checkCondition()
      #4 /app/platform_drupal_11_4_x/modules/contrib/webform/src/WebformSubmissionConditionsValidator.php(663): Drupal\webform\WebformSubmissionConditionsValidator->validateCondition()
      #5 /app/platform_drupal_11_4_x/modules/contrib/webform/src/WebformSubmissionConditionsValidator.php(642): Drupal\webform\WebformSubmissionConditionsValidator->validateConditions()

Occurs when "$value" is NULL which is possible from the "getRawValue()" call.
https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Plugin/Webfo...

Deprecated function: Using null as an array offset is deprecated, use an empty string instead i Drupal\webform\Element\WebformHtmlEditor::processTextFormat() (line 304 of /app/platform_drupal_11_4_x/modules/contrib/webform/src/Element/WebformHtmlEditor.php) #0 /app/platform_drupal_11_4_x/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
      #1 /app/platform_drupal_11_4_x/modules/contrib/webform/src/Element/WebformHtmlEditor.php(304): _drupal_error_handler()
      #2 /app/platform_drupal_11_4_x/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\webform\Element\WebformHtmlEditor::processTextFormat()
      #3 /app/platform_drupal_11_4_x/core/lib/Drupal/Core/Form/FormBuilder.php(1133): Drupal\Core\Form\FormBuilder->doBuildForm()
      #4 /app/platform_drupal_11_4_x/core/lib/Drupal/Core/Form/FormBuilder.php(1133): Drupal\Core\Form\FormBuilder->doBuildForm()
      #5 /app/platform_drupal_11_4_x/core/lib/Drupal/Core/Form/FormBuilder.php(1133): Drupal\Core\Form\FormBuilder->doBuildForm()

Occurs when "$element['format']['format']['#default_value']" is not set, which is the case if the user does not have access to the format.
https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Element/Webf...

liam morland’s picture

Thanks. A fix would be appreciated. You can make a new branch on the same issue fork and create a new merge request.

liam morland’s picture

Status: Active » Needs review

This merge request addresses the issues raised in #20 plus others. There is one failure left, #3590967: [PHP 8.5] ContentTranslationManageAccessCheck passes NULL to LanguageManager::getLanguage().

flemming.fridthjof’s picture

The fix in #3590967: [PHP 8.5] ContentTranslationManageAccessCheck passes NULL to LanguageManager::getLanguage() does not fix the deprecation warning Deprecated function: Using null as an array offset is deprecated, use an empty string instead in Drupal\Core\Language\LanguageManager->getLanguage() (line 157 of core/lib/Drupal/Core/Language/LanguageManager.php). on "/admin/structure/webform/manage/<webform-id>/translate".

The fix #3590967: [PHP 8.5] ContentTranslationManageAccessCheck passes NULL to LanguageManager::getLanguage() tries to resolve a similar issue in "core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php"

The root issue for webform originates from includes/webform.theme.inc line 173-174 (version 6.3.1)

$langcode = $route_parameters['langcode'] ?? NULL;
$language = \Drupal::languageManager()->getLanguage($langcode);

If $langcode is null it properly should not be passed to languageManager()->getLanguage()

liam morland’s picture

Thanks, @flemming.fridthjof. The tests are now passing on PHP 8.5 in the merge request. Please review.

flemming.fridthjof’s picture

I've reviewed the changes and all looks good. Great work.

  • liam morland committed 6844a4fc on 6.3.x
    fix: #3590360 Do not pass NULL to WebformTranslationManager::...

  • liam morland committed d0196c86 on 6.3.x
    fix: #3590360 Do not pass NULL to LanguageManager::getLanguage()
    

  • liam morland committed fcea0d34 on 6.3.x
    fix: #3590360 Remove deprecated ReflectionProperty::setAccessible()...

  • liam morland committed 6844a4fc on 6.x
    fix: #3590360 Do not pass NULL to WebformTranslationManager::...

  • liam morland committed d0196c86 on 6.x
    fix: #3590360 Do not pass NULL to LanguageManager::getLanguage()
    

  • liam morland committed fcea0d34 on 6.x
    fix: #3590360 Remove deprecated ReflectionProperty::setAccessible()...

liam morland’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.