-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
IOFactory::load emits errors instead of throwing exceptions #167
Comments
I've found that the code on the line 363 in the file $value = @iconv('UTF-8', 'UTF-8', $value); As I know |
The script exit can be solved by removing this block of code: if (self::getIsIconvEnabled()) {
$value = @iconv('UTF-8', 'UTF-8', $value);
return $value;
} But it doesn't remove the warnings from the question. I don't know if it is a good solution. |
Could you investigate whether one of those answers helped in your case ? |
@PowerKiKi, unfortunately I can't reproduce the Update. I've just succeed to reproduce the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue is still actual for 1.0.0-beta2, but the error message changed. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue is still actual for version 1.1.0 😕 |
I actually cannot reproduce the zend_mm_heap or Segmentation fault. This is most likely a bug in PHP itself or one of its extension. And there is not much we can do. What could be done though, is to prevent the CSV reader to accept any file. We should ideally only accept CSV files. Maybe via mimetype detection if that proves to be reliable enough on CSV files. But that should be tested. |
@PowerKiKi I don't have any extension, I use pure PHPs from MAMP. I will make a Travis CI demo soon. |
@PowerKiKi Unfortunately, Travis CI can't test PHP on macOS (i tried). I run the tests on my mac and got some errors:
|
Tested the issue in the version 1.2.0: it is fixed 🍻 |
CSV reader used to accept any file without any kind of check. That made users incorrectly believe that things were ok, even though there is no way for CSV reader to read anything else that plain text files. Fixes PHPOffice#167
This is:
What is the expected behavior?
PhpOffice\PhpSpreadsheet\IOFactory::load
throws anPhpOffice\PhpSpreadsheet\Reader\Exception
exception when it gets a file which it can't read. According to the documentation, exception must be thrown in case of problems.Or at least I can suppress errors by placing the
@
operator before calling theload
method.What is the current behavior?
When I run the script via a web server, the script just stops (browser says that the connection has been broken by the server).
When I run the script via a console,
IOFactory::load
emits errors which are not catchable by try-catch:zend_mm_heap corrupted
Segmentation fault: 11
Placing the
@
operator before callingIOFactory::load
changes nothing.What are the steps to reproduce?
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 1.0.0-beta1 – 1.1.0. PHP 7.0.15, 7.1.1 (didn't test it in other versions). I run it on macOS 10.13.3.
The text was updated successfully, but these errors were encountered: