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

Replaced bundled Zend Framework with zf1-future #2787

Closed
wants to merge 9 commits into from
Closed

Replaced bundled Zend Framework with zf1-future #2787

wants to merge 9 commits into from

Conversation

fballiano
Copy link
Contributor

Continuing the effort of removing 3rd party code from out repo.

Notes:

  • I've asked the authors of ZF1 what's the state of PHP8.1 support: State of PHP 8.1 support Shardj/zf1-future#293
  • a quick test of the frontend/backend seems to be working but...
  • it should be done only on v20 but it would be hell to maintain so no

@github-actions github-actions bot added Component: lib/Zend Component: lib/* Relates to lib/* composer Relates to composer.json labels Dec 6, 2022
@sreichel
Copy link
Contributor

sreichel commented Dec 6, 2022

I also started with this ... but ... we cant just replace Zend. Im pretty sure a few files changed here and need comparison to zf1.

(my idea was to adapt all changes from zf1 and see whats left over. yeah, takes some time ... :/)

@fballiano
Copy link
Contributor Author

Maybe those changes are not even needed anymore, they were based on software that was old, maybe today's ZF or todays' OM already fixed those things...

@sreichel
Copy link
Contributor

sreichel commented Dec 6, 2022

This should be all changes ...

Update deprecated using ${var} (#2611) sv3n* 19.09.22, 03:46 f96f0b3
add ReturnTypeWillChange to various Files catched by code style checker (#2302) Daniel Fahlke* 10.08.22, 21:24 9b656d8
Pass delimiter char to preg_quote (#2047) MarcinNowakMacopedia* 09.06.22, 10:15 fb65022
Replace APC with APCu (#1951) F1 Outsourcing Development* 06.06.22, 14:34 a978a51
Fix typo: Replace 'Retrive' with 'Retrieve' globally (#1995) Tino Mewes* 31.01.22, 15:50 6b705e4
Fix syntax in lib/Zend/Locale/Data/es_419.xml (#1901) Mohamed ELIDRISSI* 22.12.21, 11:46 904baed
Bugfix #1885 - Add to cart only accepts 1 item (#1896) Gastón De Mársico* 13.12.21, 11:42 8f8a20f
Trim trailing whitespace (#1846) luigifab* 04.10.21, 07:32 3ef5922
Change lowest PHP version to 7 (#1255) Marc* 17.05.21, 09:10 6bdcc28
Merge pull request from GHSA-m496-x567-f98c Mark Lewis* 19.04.21, 16:56 6b663bb
Fixes core and lib issues for PHP 8.0 compatibility (#1391) Eugene Lamskoy* 17.04.21, 18:28 feebf55
Fixing a bug in Zend Framework's Stream HTTP Wrapper Mark 06.04.21, 23:36 ecddab5
Fixed CRLF to LF (#1450) Milan Davídek* 27.03.21, 16:12 6ab0b92
TypeError: round(): Argument #1 ($num) must be of type int|float (#1403) Daniel Fahlke* 19.01.21, 15:22 5580c34
Fixes PHP7.4 deprecated nested ternary operators (#1393) sv3n* 17.01.21, 11:45 62d9431
bugfix(zend) Deprecated: Required parameter $A follows optional parameter $B (example) (#1349) Damian Luszczymak* 28.12.20, 21:24 79e36ff
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1348) Damian Luszczymak* 26.12.20, 04:39 1a44508
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1347) Damian Luszczymak* 26.12.20, 04:38 922fa0f
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1340) Damian Luszczymak* 26.12.20, 04:37 443863d
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1346) Damian Luszczymak* 26.12.20, 04:35 d316b02
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1345) Damian Luszczymak* 14.12.20, 18:04 8907efc
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1344) Damian Luszczymak* 14.12.20, 18:04 a681455
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1343) Damian Luszczymak* 14.12.20, 18:03 475c955
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1342) Damian Luszczymak* 14.12.20, 18:02 2c2beb8
fix "Cannot unset $this" error (#1341) Daniel Fahlke* 14.12.20, 18:01 79e4452
Add runtime cache in one more place in Zend_Data (#1018) Tymoteusz Motylewski* 24.06.20, 10:44 984dfcb
Use || operators instead of „or” (#1023) Kevin* 09.06.20, 23:58 c1105b5
Fix PHP Warning: "continue" targeting switch is equivalent to "break". (#1013) Colin Mollenhour* 04.06.20, 18:10 6321b98
Fix SQL query quoting/casting when type is passed to where function (#936) Tymoteusz Motylewski* 04.06.20, 15:54 6531710
Store unserialized data in local cache of Zend_Data (#979) Tymoteusz Motylewski* 15.05.20, 11:46 ef058f5
Fix error saving local cache in #918 Colin Mollenhour* 14.05.20, 04:54 8b89754
Add runtime cache to Zend_Locale_Data (#918) Tymoteusz Motylewski* 21.04.20, 17:24 48939f0
ZendClient breaks when receiving a HTTP/2 response (#867) Robert Coleman* 09.12.19, 11:21 1e65616
fix(oauth): sort parameters in a standard way as per the specs (#721) Pierre Martin* 03.11.19, 20:54 0e90e98
replaced deprecated php function - each() (#789) Jakub Hejtmánek* 09.07.19, 23:05 44adb24
Merge tag '1.9.3.8' into 1.9.3.x git merge 1.9.3.8 -s ours Flyingmana 15.07.18, 14:25 349f8bf
Patch SUPEE-10570 / Upgrade 1.9.3.8 spinsch* 28.02.18, 12:05 fd5b947
Upgraded to Magento 1.9.3.8 Jeroen Boersma 27.02.18, 22:52 1b7c810
Remove support for quoted-string email address format. Fixes #378 (#432) Colin Mollenhour* 08.02.18, 23:05 d85ff3d
Fixed/added doc blocks @deprecated annotations Sven Reichel* 31.01.18, 14:59 3c72e64
Duplicate case expression (#395) Leandro F. L* 13.12.17, 22:12 98f2f17
Merge pull request #300 from colinmollenhour/colinmollenhour-patch-1 Colin Mollenhour* 08.11.17, 15:50 48cc8a5
Applied SUPEE-9652 David Robinson 10.02.17, 18:55 03835f8
Import Magento Release 1.9.3.2 Lee Saferite 10.02.17, 16:51 5037921
Merge remote-tracking branch 'OpenMage/1.9.1' into 1.9.3.0 Colin Mollenhour 26.10.16, 01:39 9f9c227
Import Magento Release 1.9.3 David Robinson 13.10.16, 04:03 d48bebc
SUPEE-6788 CE_1.9.1.1_v1 David Robinson 28.10.15, 18:24 62c9207
Import Magento Release 1.9.2.2 David Robinson 28.10.15, 17:37 cabb3b1
Import Magento Release 1.9.2.2 Lee Saferite 28.10.15, 14:39 92a1142
Import Magento Release 1.9.2.0 Lee Saferite 09.07.15, 15:55 29c2709
Import Magento Release 1.9.2.0 Lee Saferite 07.07.15, 21:44 cb52550
Zend_Validate_Hostname with latest gTLD MrGekko 18.06.15, 10:46 ea68574
Import Magento Release 1.9.1.1 David Robinson 04.05.15, 23:38 e2b8244
Merge remote-tracking branch 'magento-mirror/magento-1.9' into magento-lts-1.9 Lee Saferite 25.11.14, 17:09 9dad9ef
Import Magento Release 1.9.1.0 Lee Saferite 25.11.14, 16:17 053e0b2
SUPEE-3762 Prevent showing install page after refresing SOAP index Tymoteusz Motylewski 29.10.14, 10:38 e5c5878

@sreichel
Copy link
Contributor

sreichel commented Dec 6, 2022

We have also to check core/Zend!

@addison74
Copy link
Contributor

I am an advocate for replacing the legacy Zend framework from Magento with ZF1-Future. I presented my arguments here:

#2194 (Detailed information)

#2191 (TLS issue)

If replacing the /lib/Zend directory doesn't create trouble, I can't say the same about the /app/code/core/Zend directory. I did tests removing files/directories one by one and it worked 85%, but there were also some files without which OpenMage cannot work (those related to DB operations).

Therefore, the replacement of Zend with ZF1-Future must also aim at updating these files, practically each one should be analyzed, the changes made by the Magento team understood and decided what exactly remains. It is not simple at all.

If files will remain then with each new version of ZF1-Future one of us will have to update the ones from our distribution as well, if necessary and Composer will do its job of bringing the framework into /lib/Zend.

@addison74
Copy link
Contributor

@sreichel - I have checked some of the changes you listed before that target the /lib/Zend directory and they appear to be resolved in ZF1-Future.

@fballiano
Copy link
Contributor Author

We have also to check core/Zend!

right, actually, we should remove code/Zend completely 😂😂

@fballiano
Copy link
Contributor Author

The main problem with app/code/core/Zend is that the comments reference to magento's internal ticketing system, with little to none explanation. it's almost impossible (to me at least) to understand why some patches were introduced.

But, from what I see, they're extremely old code that's most probably referring to unused code (things that got removed later on), unsupported php versions and so on.

@sreichel
Copy link
Contributor

sreichel commented Dec 8, 2022

@sreichel - I have checked some of the changes you listed before that target the /lib/Zend directory and they appear to be resolved in ZF1-Future.

I compared libZend to latest zf1-future an found some changes ...

PRs at ZF1-future:

Left/ToDo:

Done. 😎

@addison74
Copy link
Contributor

If it is necessary to create a custom version in /app/code/core, I am not opposed. The fact that we replace /lib/zend with zf1-future is a huge step forward. What would remain custom would be summarized in just a few files, that is something insignificant and that does not involve an effort to correlate with the changes in the ZF1 repository. I know that the ideal would be to have nothing left but this modification will require a long-term testing in the smallest details until we can say that nothing is affected.

@sreichel
Copy link
Contributor

sreichel commented Dec 8, 2022

@fballiano we should carefully check these files ...

  • Zend/Filter/PregReplace.php
    • added in 1.9.3.9/1.9.3.10
    • see new method _isValidMatchPattern()
    • patch ready
  • Zend/Locale/Math/PhpMath.php
    • added in 1.9.4
    • minor change that possibly could be ported to ZF1
       if (empty($op2)) {
           $op2 = 0;
       }
    
    • patch ready
  • Zend/Form/Decorator/Form.php
    • added in 1.9.3.7 / SUPEE-10415
        if ($helper == 'unserialize') {
            $filter = new Varien_Filter_FormElementName(true);
            if($filter->filter($name) != $name){
                throw new Zend_Form_Exception(sprintf('Invalid element name:"%s"', $name));
            }
        }
    
    • patch ready
  • Zend/Validate/Hostname.php
    • added with 1.9.3.0
    • see new method checkDnsRecords()
    • patch ready

Other files:

At the end we can remove all files from app/code/core/Zend and apply changes with https://github.com/cweagans/composer-patches. (Patches can be created with https://github.com/symplify/vendor-patches)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: lib/* Relates to lib/* composer Relates to composer.json
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants