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

Bogus error message if mcrypt extension is not installed. #456

Closed
samm-git opened this issue Dec 27, 2013 · 19 comments
Closed

Bogus error message if mcrypt extension is not installed. #456

samm-git opened this issue Dec 27, 2013 · 19 comments

Comments

@samm-git
Copy link
Contributor

If magento2 is running on server w/o mcrypt extension installed i am getting error

"Error happened during application run. Could not write error message to log. Please use developer mode to see the message. "

I was not able to get stacktrace using changes in di.xml, but after hacking EntryPoint.php i got

Module 'Magento_Core' depends on 'mcrypt' PHP extension that is not loaded.

#0 /var/www/magento2/lib/Magento/Module/Declaration/Reader/Filesystem.php(89): Magento\Module\Declaration\Reader\Filesystem->_checkModuleDependencies(Array, Array)
#1 /var/www/magento2/lib/Magento/Module/ModuleList.php(56): Magento\Module\Declaration\Reader\Filesystem->read('global')
#2 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(179): Magento\Module\ModuleList->__construct(Object(Magento\Module\Declaration\Reader\Filesystem), Object(Magento\App\Cache\Type\Config), 'modules_declara...')
#3 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Module\...')
#4 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Module\...')
#5 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\Module\...', Array, Array)
#6 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Module\...')
#7 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Module\...')
#8 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\Core\Mo...', Array, Array)
#9 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Core\Mo...')
#10 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Config\...')
#11 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\ObjectM...', Array, Array)
#12 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\ObjectM...')
#13 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\ObjectM...')
#14 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\App\Obj...', Array, Array)
#15 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\App\Obj...')
#16 /var/www/magento2/lib/Magento/App/ObjectManagerFactory.php(123): Magento\ObjectManager\ObjectManager->get('Magento\App\Obj...')
#17 /var/www/magento2/lib/Magento/App/EntryPoint/EntryPoint.php(80): Magento\App\ObjectManagerFactory->create('/var/www/magent...', Array)
#18 /var/www/magento2/index.php(39): Magento\App\EntryPoint\EntryPoint->run('Magento\App\Htt...')
#19 {main}

I think Magento should check extensions and print correct message instead.

@maksek
Copy link
Contributor

maksek commented Dec 27, 2013

Did you install magento2 via installer?

On Fri, Dec 27, 2013 at 11:03 PM, samm-git notifications@github.com wrote:

If magento2 is running on server w/o mcrypt extension installed i am
getting error

"Error happened during application run. Could not write error message to
log. Please use developer mode to see the message. "

I was not able to get stacktrace using changes in di.xml, but after
hacking EntryPoint.php i got

Module 'Magento_Core' depends on 'mcrypt' PHP extension that is not loaded.

#0 /var/www/magento2/lib/Magento/Module/Declaration/Reader/Filesystem.php(89): Magento\Module\Declaration\Reader\Filesystem->_checkModuleDependencies(Array, Array)
#1 /var/www/magento2/lib/Magento/Module/ModuleList.php(56): Magento\Module\Declaration\Reader\Filesystem->read('global')
#2 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(179): Magento\Module\ModuleList->__construct(Object(Magento\Module\Declaration\Reader\Filesystem), Object(Magento\App\Cache\Type\Config), 'modules_declara...')
#3 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Module...')
#4 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Module...')
#5 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\Module...', Array, Array)
#6 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Module...')
#7 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Module...')
#8 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\Core\Mo...', Array, Array)
#9 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\Core\Mo...')
#10 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\Config...')
#11 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\ObjectM...', Array, Array)
#12 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\ObjectM...')
#13 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(132): Magento\ObjectManager\ObjectManager->get('Magento\ObjectM...')
#14 /var/www/magento2/lib/Magento/ObjectManager/Factory/Factory.php(172): Magento\ObjectManager\Factory\Factory->_resolveArguments('Magento\App\Obj...', Array, Array)
#15 /var/www/magento2/lib/Magento/ObjectManager/ObjectManager.php(98): Magento\ObjectManager\Factory\Factory->create('Magento\App\Obj...')
#16 /var/www/magento2/lib/Magento/App/ObjectManagerFactory.php(123): Magento\ObjectManager\ObjectManager->get('Magento\App\Obj...')
#17 /var/www/magento2/lib/Magento/App/EntryPoint/EntryPoint.php(80): Magento\App\ObjectManagerFactory->create('/var/www/magent...', Array)
#18 /var/www/magento2/index.php(39): Magento\App\EntryPoint\EntryPoint->run('Magento\App\Htt...')
#19 {main}

I think Magento should check extensions and print correct message instead.


Reply to this email directly or view it on GitHubhttps://github.com//issues/456
.

@samm-git
Copy link
Contributor Author

No, git clone in the www/magento2 directory

@ihor-sviziev
Copy link
Contributor

@samm-git,
In system requirements(https://wiki.magento.com/display/MAGE2DOC/System+Requirements) we have mcrypt extension, so magento shouldn't work w/o it.

@samm-git
Copy link
Contributor Author

@igor-svizev i am agree with this. But Magento should provide reasonable error message for this instead of bogus one. It is very common to not have required extension and error "Error happened during application run. Could not write error message to log. Please use developer mode to see the message. " is absolutely useless in this case. Especially because all file permissions were set correctly.

@benmarks
Copy link
Contributor

@samm-git what would you find to be more "reasonable" than

Module 'Magento_Core' depends on 'mcrypt' PHP extension that is not loaded.

?

@samm-git
Copy link
Contributor Author

@benmarks please read error message again before commenting. Only error with unpatched magento is "Error happened during application run. Could not write error message to log. Please use developer mode to see the message. ". To get stacktrace i had to patch magento.

@sshymko
Copy link

sshymko commented Jan 2, 2014

+1 for not hiding/obscuring original error messages.

@buskamuza
Copy link
Contributor

Looks like, this is a bug in processing errors. It should be fixed so that errors will be logged.
I think, it's not good approach to show errors in non-developer mode.

@benmarks
Copy link
Contributor

benmarks commented Jan 4, 2014

@samm-git Would you prefer that the application be in developer mode when installing? This would render verbose error messages during what is certainly a developer interaction. However (for example) if mcrypt is removed in a production server, the generic error message seems appropriate.

@samm-git
Copy link
Contributor Author

samm-git commented Jan 5, 2014

@benmarks as SA and Magento consultant i would prefer to display such critical errors, especially on installation stage. I don`t see any problems to show "mcrypt extension is not insalled" on prod or on dev. Also for the user not experienced with Magento or PHP it would be hard, if ever possible to find what is wrong, because "Could not write error message to log. " is not appropriate and misleading. E.g. i was searching for file permissions problems instead of looking on installed extensions.

@benmarks
Copy link
Contributor

benmarks commented Jan 5, 2014

I don't see any problems to show "mcrypt extension is not insalled" on prod or on dev

Perhaps it's different with your clients or in the regions you serve, but I can imagine most clients being upset with or firing their developer immediately if a developer-worded / hard error message were rendered to a site consumer. Obviously having a further error condition of not being able to write to the log file complicates matter of getting information to the developer. But, I'd still take this issue further to state that even the generic message which you saw is not generic enough, not in production. I recognize the validity of your counter argument and join you in wondering which way the core team will take this.

@duffybelfield
Copy link

+1 to non descript error, purely because a customer will generally get very
excited with the word 'crypt' and panic about a security issue etc.
On 05/01/2014 5:56 PM, "Benjamin Marks" notifications@github.com wrote:

I don't see any problems to show "mcrypt extension is not insalled" on
prod or on dev

Perhaps it's different with your clients or in the regions you serve, but
I can imagine most clients being upset with or firing their developer
immediately if a developer-worded / hard error message were rendered to a
site consumer. Obviously having a further error condition of not being able
to write to the log file complicates matter of getting information to the
developer. But, I'd still take this issue further to state that even the
generic message which you saw is not generic enough, not in production.
I recognize the validity of your counter argument and join you in wondering
which way the core team will take this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/456#issuecomment-31610435
.

@samm-git
Copy link
Contributor Author

samm-git commented Jan 5, 2014

@benmarks yeah,, probably in YOUR region developers and clients like to see messages like that one instead of real cause. Are you serious? And please, stop teaching me. I am working with largest Magento installations as part of Magento ECG team.

And hey, we are talking about installer errors. If installer is showing on prod site then something is definitively VERY wrong, and probably its not a developer fault ;-) And i don`t see any differences for business owners if site renders shitty message about fake error or one about real error. Both situations are not acceptable on prod, but second one at least will give a chance to fix it QUICKLY instead of reading Magento code and patching source ;-)

@benmarks
Copy link
Contributor

benmarks commented Jan 5, 2014

@samm-git Clearly we have a difference of opinion (which is reasonable, as I stated), and clearly you are misunderstanding my tone and purpose in participating in this discussion. I've stated my opinion and logic for the core team's consideration, so I'm done participating on this thread.

Please feel free to introduce yourself in person sometime, as it seems we both do some work for/with people at ECG.

@samm-git
Copy link
Contributor Author

samm-git commented Jan 5, 2014

@benmarks I do not see arguments here, sorry.

  1. Magento 1 was able to display such kind of errors in proper manner. I don't remember any of the security warnings about this, and AFAIR it is still in 1.13.1.
  2. Error text here is about different kind of error at all.
    Error happened during application run. Could not write error message to log. Please use developer mode to see the message.
    Is an error from Magento 2. No information about how to enable dev. mode (???) here, bogus information about inability to write error log (all permissions are set correctly).
  3. Latest Magento CE actually starts installer and show error message
    PHP extension "mcrypt" must be loaded. Please set all required settings before clicking Continue
    Please let me know what is not reasonable in message from CE and why first message looks logically for you. Also i am waiting for the bug to Magento CE if you really feel that mcrypt related message is security risk :) And btw, installer starts ONLY if no configuration found, so Magento will not be able to work anyway (its about possible problem on prod).

@verklov
Copy link
Contributor

verklov commented Feb 4, 2014

@samm-git , I personally agree that the error message displayed currently is misleading. Since I am not a tech savvy guy, I would be very confused and would probably start googling for developer mode in Magento and so on and so forth. Thus, no reason for me to argue that there is no issue since mcrypt is stated as a required component in system requirements :)

The team investigated the issue and we found out that previously, if some of the required extensions were not installed, the system would issue an appropriate message during the installation. However, due to some recent changes, we lost this ability.

What I personally can do is create a ticket (what I actually already did) in our bug tracker to have the ability to show proper human error messages back.

In your original message I read that you had to hack EntryPoint.php to be able to read the error message. Please let me know if I may help you with the information on how to enable developer mode. I know this is not a remedy for this kind of cases - as I already wrote, we will work on getting the normal installation behavior back when error messages are understandable.

@samm-git
Copy link
Contributor Author

samm-git commented Feb 4, 2014

@verklov thank you for reply and confirmation that this is wrong behavior :) Information about enabling of the devmode correctly is interesting, thanks.

@verklov
Copy link
Contributor

verklov commented Feb 4, 2014

@samm-git , you are welcome! :)

To enable Developer mode, add the SetEnv MAGE_MODE 'developer' string at the end of the .htaccess file in the root folder where Magento is installed.

@verklov
Copy link
Contributor

verklov commented Apr 23, 2014

@samm-git, the team has fixed this issue and deployed the code to the GitHub. For some reason the issue was not referenced in the changelog. We are closing this issue. We will address the documentation issue to have the procedure of enabling the developer mode properly documented and publicly available.
If for some reason you would still experience the same issue as described above, please leave a comment to this issue or open a new one.

@verklov verklov closed this as completed Apr 23, 2014
vpelipenko added a commit that referenced this issue Jul 15, 2015
magento-team pushed a commit that referenced this issue Mar 19, 2016
…right

[Extensibility] MAGETWO-48081: Copyright Year Update
mmansoor-magento pushed a commit that referenced this issue Oct 3, 2016
- MAGETWO-47698: [Github] Custom options not displayed correctly on a store view level #2908 #5885
- MAGETWO-56411: [GitHub] Shopping cart product options missing #248 
- MAGETWO-58242: Issue with an Import Export when Attribute Changes
- MAGETWO-58053 [GITHUB] Product image issue with multiple store views Magento 2.1.0 #6259
magento-devops-reposync-svc pushed a commit that referenced this issue May 24, 2022
Cabpi 324. Org check with new endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants