Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ver 1.29 ) Csv auto_detect_line_endings #3960

Closed
KIMKYEONGYONG opened this issue Mar 25, 2024 · 4 comments
Closed

ver 1.29 ) Csv auto_detect_line_endings #3960

KIMKYEONGYONG opened this issue Mar 25, 2024 · 4 comments

Comments

@KIMKYEONGYONG
Copy link

This is:

- [ V] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

my php version 8.1 , 8.1 is <auto_detect_line_endings>method deleted!

@MarkBaker
Copy link
Member

In PHP 8.1, the auto_detect_line_endings INI directive has been deprecated, not deleted.

@KIMKYEONGYONG
Copy link
Author

phpoffice/phpspreadsheet 1.29.0 ver

PhpOffice\PhpSpreadsheet\Reader\Csv;

private function setAutoDetect(?string $value): ?string
{
    $retVal = null;
    if ($value !== null && $this->testAutodetect) {
        $retVal2 = @ini_set('auto_detect_line_endings', $value);  <<  error!
        if (is_string($retVal2)) {
            $retVal = $retVal2;
        }
    }

    return $retVal;
}

@MarkBaker
Copy link
Member

There should be no error in this code, and that line should not generate any error.

What is the exact error message that you are getting?

@oleibman
Copy link
Collaborator

I have seen cases where user-supplied error handlers have inappropriately detected and converted the suppressed deprecation message to an error despite the use of the at-sign to suppress messages. That is the reason for the check on testAutodetect in the code cited above. Users unwilling to correct their error handler can add $reader->setTestAutodetect(false) to their code before loading the spreadsheet; they will prematurely lose the ability to detect Mac line endings (which is very unlikely to be an issue), and the error message will go away because ini_set will not be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants