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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | deprecated_method_getcontent-3230521-5.patch | 480 bytes | nico972 |
Issue fork csv_serialization-3230521
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
Comment #2
driverok commentedWhat if we just change the line
to
as it is proposed in AbstractCsv class?
Please check the created MR
Comment #4
driverok commentedComment #5
nico972 commentedI 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.
Comment #6
markdorisonComment #7
markdorisonUpdated league/csv version requirement to ^9.7 in MR4.
toString() was added in 9.7.0.
* https://csv.thephpleague.com/9.0/connections/output/#printing-the-document
* https://github.com/thephpleague/csv/commit/0047c1cbea2dcb8d0638d052b48b5...
Comment #8
steven jones commentedLooks like this was fixed in #3405366: Resolve issues reported by PHPCS, PHPStan