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

Updated PHPStan to 1.9.13 and ZF1Future to 1.22 #2960

Merged
merged 9 commits into from
Jan 19, 2023

Conversation

fballiano
Copy link
Contributor

@fballiano fballiano commented Jan 17, 2023

@github-actions github-actions bot added the composer Relates to composer.json label Jan 17, 2023
@fballiano
Copy link
Contributor Author

These patches are not applied correctly anymore:

    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.10.patch (MAG-1.9.3.10)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.10.patch
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.4.0.patch (MAG-1.9.4.0)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.4.0.patch
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-295.patch (ZF-295 - SUPEE-9652/10570)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-295.patch
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-296.patch (ZF-296 - Better IIS suport)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-296.patch
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-297.patch (ZF-297 - Invalid argument type)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-297.patch

@sreichel
Copy link
Contributor

See #2956

@fballiano
Copy link
Contributor Author

oops, missed that :-D

@sreichel
Copy link
Contributor

Patches can be removed.

@fballiano
Copy link
Contributor Author

done! ❤️

@sreichel
Copy link
Contributor

ZF-299 has been merged too. Please check.

@fballiano
Copy link
Contributor Author

it gets applied, i'll check the source code after a call I've to do in 5 min :-)

@fballiano
Copy link
Contributor Author

@sreichel it seems ZF-299 wasn't merged in 1.22, if you check https://github.com/Shardj/zf1-future/blob/release-1.22.0/library/Zend/Date.php it doesn't have any of the code included in the patch.

@sreichel
Copy link
Contributor

@fballiano
Copy link
Contributor Author

ZF299 patches Zend/Date.php

Screenshot 2023-01-17 alle 11 12 32

@fballiano
Copy link
Contributor Author

mmmm I see what you mean, but is it ok if Zend/Date.php stays without the patch that now has been added upstream to DateObject.php?

@sreichel
Copy link
Contributor

Mhhh, my PR targets Zend/Date/DateObject.php ....maybe something went wrong here. I'll check it later.

@sreichel
Copy link
Contributor

Just from memory ...

Did magento added this to Zend/Date.php with calling parent method (in Zend_Date_DateObject)?

Quick check lgtm.

@fballiano
Copy link
Contributor Author

right, it extends Zend_Date_DateObject, removing that patch in 1 minute

@sreichel
Copy link
Contributor

but is it ok if Zend/Date.php stays without the patch that now has been added upstream to DateObject.php?

class Zend_Date extends Zend_Date_DateObject

Y.

@fballiano
Copy link
Contributor Author

uff, sorry for the many commits, kinda busy in this very moment

@fballiano
Copy link
Contributor Author

I think some of the other patches could be merged by ZF1F (maybe not all sadly), @sreichel are you in direct contact with @Shardj?

@sreichel
Copy link
Contributor

No, im not in contact with @Shardj.

There should be three MAG-patches left (ignoring MAG-1.1). I'll add them in time.

OM-patches may need to be reviewed before create PR at ZF1F.

sreichel
sreichel previously approved these changes Jan 17, 2023
@sreichel
Copy link
Contributor

Ignore phpstan error ... (possibly repeating error is fixed with removal of code/core/Zend)

Ill update tomorrow,

@fballiano
Copy link
Contributor Author

@sreichel I wanted to submit patches/MAG-1.9.3.9.patch to zf1 but I've seen that in https://github.com/OpenMage/magento-lts/blame/v20.0.18/lib/Zend/Validate/EmailAddress.php (that file for version 20.0.18) that patch wasn't applied.

Just out of curiousity, how did you find the patches? I tried to find info about the modification itself, to provide it to zf1, but had no luck in finding the right SUPEE with details of the fix :-\

@fballiano fballiano changed the title Updated PHPStan to 1.9.12 and ZF1Future to 1.22 Updated PHPStan to 1.9.13 and ZF1Future to 1.22 Jan 18, 2023
ADDISON74
ADDISON74 previously approved these changes Jan 18, 2023
@elidrissidev
Copy link
Member

Some new phpstan errors popped up, possible related to the patch files removed?

@sreichel
Copy link
Contributor

@fballiano i think this patch was applied to core/code/Zend.

@fballiano fballiano merged commit 8d0828e into OpenMage:1.9.4.x Jan 19, 2023
@fballiano fballiano deleted the update_deps branch January 19, 2023 00:03
@fballiano
Copy link
Contributor Author

merged and cherrypicked to v20

@justinbeaty
Copy link
Contributor

There's an issue with deleting the patches in the source tree, because composer.json requires it from:

https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.10.patch

But now, that file is 404. So if you have a commit earlier than this one, composer install will fail to apply these patches.

To reproduce:

git checkout 2a8e91dffba41cc45f8a62332b1fa4d8c9e8484d
composer install --no-dev --ignore-platform-reqs

output:

  - Applying patches for shardj/zf1-future                                                           
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.1.1.patch (MAG-1.1.1)                                                                                                     
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.0.patch (MAG-1.9.3.0)                                                                                                 
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.7.patch (MAG-1.9.3.7 - SUPEE-10415)
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.9.patch (MAG-1.9.3.9)
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.10.patch (MAG-1.9.3.10)                                                                                               
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.3.10.patch" file could not be downloaded (HTTP/1.1 404 Not Found)
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.4.0.patch (MAG-1.9.4.0)
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/MAG-1.9.4.0.patch" file could not be downloaded (HTTP/1.1 404 Not Found)    
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-295.patch (ZF-295 - SUPEE-9652/10570)
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-295.patch" file could not be downloaded (HTTP/1.1 404 Not Found)
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-296.patch (ZF-296 - Better IIS suport)                                                                                       
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-296.patch" file could not be downloaded (HTTP/1.1 404 Not Found)         
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-297.patch (ZF-297 - Invalid argument type)                                                                                   
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-297.patch" file could not be downloaded (HTTP/1.1 404 Not Found)         
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-299.patch (ZF-299 - Limit mktime() year)                                                                                     
   Could not apply patch! Skipping. The error was: The "https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-299.patch" file could not be downloaded (HTTP/1.1 404 Not Found)         
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/OM-918.patch (OM-918 - Add runtime cache to Zend_Locale_Data)                                                                   
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/OM-1081.patch (OM-1081 - Not detecting HTTPS behind a proxy)                                                                    
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/OM-2047.patch (OM-2047 - Pass delimiter char to preg_quote)                                                                     
    https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/OM-2050.patch (OM-2050 - Prevent checking known date codes)

So far it's not a big problem because we don't have any tag where we use cweagans/composer-patches. But if we were to make a new tag v19.4.22, and then after that delete another patch, some users could end up with patches missing.

My first attempt to fix was to define patches like this:

"patches": {
	"shardj/zf1-future": {
		"MAG-1.1.1": "./patches/MAG-1.1.1.patch",
		"MAG-1.9.3.0": "./patches/MAG-1.9.3.0.patch",
		"MAG-1.9.3.7 - SUPEE-10415": "./patches/MAG-1.9.3.7.patch",
		"MAG-1.9.3.9": "./patches/MAG-1.9.3.9.patch",
		"OM-918 - Add runtime cache to Zend_Locale_Data": "./patches/OM-918.patch",
		"OM-1081 - Not detecting HTTPS behind a proxy": "./patches/OM-1081.patch",
		"OM-2047 - Pass delimiter char to preg_quote": "./patches/OM-2047.patch",
		"OM-2050 - Prevent checking known date codes": "./patches/OM-2050.patch"
	}
}

Which does work on if you clone this repo and composer install, but fails if you install via aydin-hassan/magento-core-composer-installer. This PR needs to be installed for it to work: cweagans/composer-patches#417

So, then we should either reference the patches with the commit hash in the URL:

https://raw.githubusercontent.com/OpenMage/magento-lts/37227a383ce29c1df6342a45e4d48bb839876d37/patches/MAG-1.9.3.10.patch

Or, make a new repo for it, openmage/magento-lts-patches or whatever where the patch files will never be deleted.

@sreichel
Copy link
Contributor

We should keep it in mind, but actually it should be no problem (unless your branch isnt up2date).

We have no release including ZF1F that requires these files, but its a good idea to move them outside.

@justinbeaty
Copy link
Contributor

It's not a problem now, but will be if we were to tag a release today. Because then the patch files could never be deleted from this repository without breaking that release.

@sreichel
Copy link
Contributor

@fballiano can you please add at "patch-repo"?

@fballiano
Copy link
Contributor Author

Like zf1patches? Or composerpatches?

@sreichel
Copy link
Contributor

sreichel commented Jan 19, 2023

I'd prefer "vendor-patches" (or "composer-patches")

@fballiano
Copy link
Contributor Author

https://github.com/OpenMage/composer-patches

@elidrissidev
Copy link
Member

elidrissidev commented Jan 20, 2023

For the issue with the deleted files, that could've been solved simply by using the permalink which uses the latest commit id, instead of the one with the branch name:

Still works: https://raw.githubusercontent.com/OpenMage/magento-lts/6b0408fce476a738b7008bd3a4b99921fef2ee80/patches/ZF-299.patch
Doesn't work: https://raw.githubusercontent.com/OpenMage/magento-lts/1.9.4.x/patches/ZF-299.patch

@fballiano
Copy link
Contributor Author

@elidrissidev great idea

@justinbeaty
Copy link
Contributor

Note that I did mention that in my comment, So, then we should either reference the patches with the commit hash in the URL: [...]

But, a separate repo is still better IMO, because it could be too easy to modify a patch and forget to update the hash in the same PR. Or you do update the hash, but then the hash changes when you squash. Also, finally, older tagged versions still use the older patch [may be a good or bad thing].

@fballiano
Copy link
Contributor Author

the fact that the old tagged version would use the older patch I think it would be a "must have"

@justinbeaty
Copy link
Contributor

I'm not against using commit hashes. I guess modifying or introducing a patch need to be done in one PR, and referencing the patch in composer.json needs to be done in a second PR? I think at least...

It would be nice if this was merged instead: cweagans/composer-patches#417

@elidrissidev
Copy link
Member

It would be nice if this was merged instead: cweagans/composer-patches#417

That would be the best way to do it, but the activity on that repo is very slow, so I have to agree with the current way for now.

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

Successfully merging this pull request may close these issues.

ZF1F update (v 1.22.0)
5 participants