-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Use '===' operator to check if file was written. #26688
Use '===' operator to check if file was written. #26688
Conversation
This prevents incorrect logic when writing empty string (0 bytes).
Hi @vovayatsyuk. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vovayatsyuk,
Could you fix failing static tests in files that you’ve touched and cover your changes with some kind of tests? I think integration tests is most suitable here
… fix-incorrect-exception-when-writing-0-bytes
I will take care of test coverage. |
94cf975
to
e2e9a86
Compare
e2e9a86
to
66d2cbc
Compare
Functional test failures not related to changes from this pr |
Hi @ihor-sviziev, thank you for the review. |
✔️ QA passed |
Hi @vovayatsyuk, thank you for your contribution! |
Description
This commit prevents incorrect logic when writing empty string (0 bytes).
See manuals for corresponding functions:
Manual testing scenarios
To test this PR, you need to edit some PHP code. The easiest way is to edit some core code:
Open
Magento/Catalog/Controller/Adminhtml/Product/Index.php
Add the following code at the top of
execute
method:Now open Catalog > Products page.
An exception will be thrown: "The specified "var/log/system.log" file couldn't be written."
Apply the patch and you'll see "Bytes written: 0" message instead of exception.
Questions or comments
Make sure that your web server has write access to the "var/log/system.log" file.
Contribution checklist (*)