-
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
Remove Zend1 captcha from Magento2 Captcha module #8356
Remove Zend1 captcha from Magento2 Captcha module #8356
Conversation
Maybe outside of this request but I was also thinking about making the class |
The fails during the integration tests in php5.6 I think are down to configuration of Php5.6 gd on the travis envs. https://travis-ci.org/magento/magento2/jobs/196987191#L643 From the Zend point of view these exceptions have always been there and will cause an issue on the front end if the fonts are not there. The only change has been that the exceptions are now thrown in the constructor rather than a method that was never covered in the build process. Unfortunately I would need some help debugging on the travis end but I can tell you on my PHP5.6 and PHP7 versions everything runs fine with linux 16 and not 14. |
f4229fb
to
c926ee4
Compare
@dmanners Thank you for your contribution to Magento 2 project and updating outdated parts of our platform.
According to Magento 2 Backward compatibility policy, I wouldn't recommend make it final. In this case that will be Backward incompatible Change (BiC). All existing plugins for this class will be ignored, since it will be impossible to generate interceptor for this class. |
@okorshenko thanks for the feedback. Easy reply first with regards to backwards compatibility I get it don't worry it was just food for thought. I nice read on the who "when to make classes final" is http://ocramius.github.io/blog/when-to-declare-classes-final/ but for Magento I get their point also. With regards to the integration tests failing we could add in some setup checks during test setup for if the environment has the function or not. Then in this case the test would still run on PHP7 but not fail on PHP5.6 and then once the travis support has got back to you the test could automatically start running once the env has changed.
Something like this could be added to either the individual test cases or the abstract test setup. Down side is that there would be a lot of tests that are skipped. |
beb391f
to
3bfd544
Compare
All other pull requests in the "Remove Zend1 from Magento Captcha" series can be found: |
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.
In general, I agree on solution
$this->markTestSkipped('This test is skipped as the enviournment does not allow for imageftbbox');
but we need to adjust this approach slightly.
Honestly, I don't think that we need app/code/Magento/Captcha/Model/DefaultModel.php
in every failed test. So we can try:
add new preference here https://github.com/magento/magento2/blob/develop/dev/tests/integration/etc/di/preferences/ce.php
Declare proxy for Magento/Captcha/Model/DefaultModel.php. In this way we will delay instantiation of this class in the integration tests. I hope that this will decrease the number of skipped tests.
Also, please, try to fix unit test
Thank you for your effort on this!
+100500 to your karma! :)
@@ -517,7 +524,7 @@ protected function _randomSize() | |||
* Now deleting old captcha images make crontab script | |||
* @see \Magento\Captcha\Cron\DeleteExpiredImages::execute | |||
*/ | |||
protected function _gc() | |||
protected function gc() |
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.
Please, add SuppressWarnings here. Something like that:
Added SuppressWarnings since this method is declared in parent class and we can not use other method name.
@SuppressWarnings(PHPMD.ShortMethodName)
@okorshenko thanks for the feedback. I will have a look at this over the MageStackDay weekend. I just noticed there was more Zend1 that I probably cannot remove until the core DB lib has been changed :( but I can keep pushing some parts of the system! |
composer.json
Outdated
@@ -31,6 +31,7 @@ | |||
"zendframework/zend-serializer": "~2.4.6", | |||
"zendframework/zend-log": "~2.4.6", | |||
"zendframework/zend-http": "~2.4.6", | |||
"zendframework/zend-captcha": "~2.4.6", | |||
"magento/zendframework1": "~1.12.16", |
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.
now my big question @okorshenko is who do we have to bribe/blackmail to get them to remove Captcha from this repo and create a new tag to be used in Mage2? Something like 2.0.0 would be nice here as this will fit well with http://semver.org/ as removing Captcha from zendframework1 would mean that this could not be used in Magento1.
d717032
to
4c4b77a
Compare
@dmanners Just for your information
Unfortunately, their suggestion does not work for us since Precise infrastructure does not support mysql-server=5.6 (which is required by Magento 2). It supports 5.5 only. Thank you for your patience! |
Hi @okorshenko I have added the test version of the Default model that does not call the main constructor https://github.com/magento/magento2/pull/8356/files#diff-95faa1d786f0d7e3b6288e0d80f1583cR13 is there anything else that I can do with this PR as yet or is it sadly just a waiting game? Thanks |
…derscore at the start
…Captcha\Image value
…de of the parent method and as such we cannot control the name
…et around tests failing on travis as imageftbbox is not installed on the travis php5.6 image
…/TestFramework/Captcha/DefaultModel.php file
902e741
to
ee23cdd
Compare
@dmanners thank you for the fix. I will do some adjustments for the code and merge this PR. Thank you! |
@dmanners Zend1 captcha is removed from Magento2 Captcha by your contribution! Thank you! |
Hi guys, I get this error in the last dev version:
How have I to solve it? |
hey @shinesoftware have you run a |
@dmanners solved thanks! |
GraphQl. Reset mutable state after request
Since Zend1 has reached it's end of life we should migrate the Captcha module over to Zend2.
In this PR I have updated the class
app/code/Magento/Captcha/Model/DefaultModel.php
to extend\Zend\Captcha\Image
rather than the Zend1 version.I have updated the functions and variables that have changed between Zend1 and Zend2.