Drupal.AjaxError - ContentImport::$file is deprecated

Created on 9 July 2025, about 1 month ago

Problem/Motivation

Drupal.AjaxError
message
:
"\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /admin/config/content/contentimport?ajax_form=1\nStatusText: parsererror\nResponseText: \nDeprecated: Creation of dynamic property Drupal\\contentimport\\Form\\ContentImport::$file is deprecated in /var/www/html/docroot/modules/contrib/contentimport/src/Form/ContentImport.php on line 109\n[{\"command\":\"update_build_id\",\"old\":\"form-kkyoh-SPvCE5Cq1xwfjwm3KcrCelc0o26CEQrsFIe5k\",\"new\":\"form-MJXmDbHDHVh6wTGBHYxY6e8kWvMD8Et_RIYDgnQ-0lM\"},{\"command\":\"insert\",\"method\":\"html\",\"selector\":\"#content_import_field"
name
:
"AjaxError"
stack

Deprecated: Creation of dynamic property Drupal\contentimport\Form\ContentImport::$file is deprecated in ContentImport.php on line 108

This is a PHP 8.2+ deprecation. In newer PHP versions, creating dynamic properties (i.e., assigning a property that wasn't declared in the class) is no longer allowed by default.

Steps to reproduce

Go to /admin/config/content/contentimport . You won;t be able to download sample csv file and also you would see the Error message -
"Oops, something went wrong. Check your browser's developer console for more details."

Proposed resolution

Declare the property explicitly
In ContentImport.php, find the ContentImport class and add this line near the top of the class:
protected $file;

πŸ› Bug report
Status

Active

Version

10.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States morampudi.sowji

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

Comments & Activities

Production build 0.71.5 2024