Problem/Motivation

Upgrade status module throws this warning Call to deprecated method getContent() of class League\Csv\AbstractCsv in csv_serialization/src/Encoder/CsvEncoder.php.

Steps to reproduce

  • Install latest vanilla drupal 8.x
  • Install 8.x-2.0 version of csv serialization module
  • Install upgrade_status module
  • From upgrade_status report page, Scan csv_serialization module and you will see the deprecation error.

Proposed resolution

It looks like the getContent() function of League\Csv\AbstractCsv class will be removed in next major release. And the way csv_serialization requires league/csv in composer.json, Anyone requiring the csv_serialization module will automatically fetch the major release of league/csv and thereby could get affected with these deprecations.

Temporary solution: We could lock the league/csv to 9.7.1 in composer.json and create a release to be safe from the errors.
: Well, It will be to review the deprecations and use proper code from new release of league/csv

Remaining tasks

User interface changes

API changes

Data model changes

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

kunalkursija created an issue. See original summary.

driverok’s picture

What if we just change the line

$output = $csv->getContent();

to

$output = $csv->toString();

as it is proposed in AbstractCsv class?

Please check the created MR

driverok’s picture

Status: Active » Needs review
nico972’s picture

StatusFileSize
new480 bytes

I am OK with commit from driverok.

The getContent() method from abstract class AbstractCsv calls its own toString() method.

I put the .patch file here from the diff merge request.

markdorison’s picture

Version: 8.x-2.0 » 4.x-dev
markdorison’s picture

steven jones’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3405366: Resolve issues reported by PHPCS, PHPStan