-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix a PHP error being thrown on a Magento error being thrown #32814
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
Conversation
Hi @MJTheOne. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
Not sure why we need change the pub/media to incorrect permissions/owners for reproduce |
After a deployment I somehow ended up with incorrect permissions, and got the error "Undefined index 'directory'" in stead of the actual error "Unable to save.." To be fair, this is probably not a situation that will happen often. Doesn't take away the fact the code is incorrect in assuming 'directory' is set as index on $file. |
Can you add screenshot show issue errors ? Or video records if possible. What php version and magento version used |
@magento create issue |
@magento run WebAPI Tests, Functional Tests B2B |
[image removed] PHP: 7.4.15 Well, I'll be damned. I am getting the error again (by setting the permissions incorrectly to be able to create a screenshot), but I'm not getting the "Undefined index 'directory'.." anymore.. |
Can you update infor in ticket description |
Done! |
@magento run Functional Tests B2B |
@mrtuvn I believe that covering this case with a test would be quite easy, so it's better to cover it in order not to have any regression here in the future. @MJTheOne, will you be able to cover your change with a simple unit test? |
Agreed! Let's cover its with automated test |
I'll get on it asap! |
I'm sorry it's taking me a while. Having some trouble with how this is set up. The tests want to run "setup:install", which I find weird. Also been a bit busy. Will try to update this week! |
Unit test added! Took me a while to figure out how this is set up. It's not like I have no UnitTest experience, just overlooked a few things so it was quit confusing at the start. |
On it! |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Unit Tests, Integration Tests, Functional Tests EE, Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Failed Unit test "ui/js/grid/columns/multiselect.Default state - Select no rows" is not related to changes |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Hi @ihor-sviziev, thank you for the review. |
@magento run Unit Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Hello @MJTheOne, I have tried to reproduce the issue in Magento version 2.4-develop with the following steps. But unable to reproduce the issue:
The product edit page is open without any error. I have also applied some logs in Please let us know if we missed any steps in order to reproduce the issue. Thanks |
Hey @engcom-Hotel As discussed before. I think it has to do with an S3 module I have installed, because I could very easily reproduce it on my server but not on a fresh install. And as we all (kinda silently) agreed upon, the assumption the code makes in the Exception, even though it's extensively checked before the Exception, is incorrect, hence why the PR wasn't closed. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Description (*)
I ran into a small problem with the product media (because my pub/media wasn't writable). But I did not get the actual error that is thrown, I got a PHP error because 'directory' was not set (as you can see by my fix).
I thought, why not have my first contribution be a simple fix.
PHP: 7.4.15
Magento: 2.4.2
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Screenshot of the PHP Notice in stead of the actual error being thrown (also in the exception.log)

Questions or comments
Contribution checklist (*)
Resolved issues: