Four SplFileObject CSV methods are now deprecated in PHP 8.6. The change came to php-src this week, and it's part of the Deprecations for PHP 8.6 RFC that PHP internals voted on earlier this month.
Nothing stops working in 8.6, but calling a deprecated method emits an E_DEPRECATED notice and returns what it always returned. Removal will come in PHP 9.
What Is Deprecated
Four methods on SplFileObject picked up a #[\Deprecated(since: '8.6')] attribute:
SplFileObject::fgetcsv()SplFileObject::fputcsv()SplFileObject::setCsvControl()SplFileObject::getCsvControl()
The standalone fgetcsv() and fputcsv() functions are untouched, and so is the SplFileObject::READ_CSV flag. If you read CSV files through a plain file handle, this deprecation doesn't affect you.
Why They're Going Away
The proposal came from Muhammed Arshid. Here is how the RFC puts it:
These APIs have become increasingly difficult to maintain due to historical design issues and inconsistencies. The introduction of named arguments has further exposed problems in the API design and behavior.
The RFC also says the code is in the wrong place:
CSV processing functionality does not naturally belong in
SplFileObject, and future work would be better served by a dedicated CSV extension providing a cleaner and more maintainable API.
The Vote
Voting closed on August 10, 2026, with 25 in favor, 5 against, and 15 abstentions. It's one of a long list of proposals bundled into the 8.6 deprecations RFC, and we covered the full set of results when the votes finished.
What It Means for Your Code
Here is what a deprecated call looks like:
// Deprecated in PHP 8.6 $file = new SplFileObject('data.csv'); $file->setCsvControl(';'); while (($row = $file->fgetcsv()) !== false) { // ... }
The direct replacement is the function pair on a regular handle:
$handle = fopen('data.csv', 'r'); while (($row = fgetcsv($handle, separator: ';')) !== false) { // ... } fclose($handle);
You get the same parsing without the deprecation notice. If you want quoting rules, headers, and stream filters taken care of instead, a package like League\Csv handles all of that and works on every supported PHP version.
Read More
The commit has the stub changes and the reorganized tests, and the RFC section has the full rationale. The proposal ran on the internals list, where the missing migration path and the READ_CSV flag left behind both came up. PHP 8.6 is already in beta, so now is a good time to run your test suite against it and see what turns up.