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

add public properties for php 8.2 support #356

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

earthiverse
Copy link
Contributor

Description

Similar to #348, but for the marketing API

See https://php.watch/versions/8.2/dynamic-properties-deprecated for why this is necessary.

Copy link

cla-bot bot commented Feb 13, 2024

Contributor License Agreement Instructions
Thanks for your pull request. Before we can review your work, you’ll need to sign a Contributor License Agreement (CLA).

Please download the appropriate CLA below. Once downloaded, please read, sign, and send back to us at developer-cla@mailchimp.com. Please note, this account is not monitored so please visit https://mailchimp.com/contact/ if you need support.

Individual CLA: Mailchimp Individual CLA
Corporate CLA: Mailchimp Corporate CLA

Once you’ve emailed us the signed CLA, please reply here (e.g. CLA signed and sent!) and we’ll verify it.

What to do if you already signed the CLA
Individual signers
• If you’ve previously sent us a signed CLA, please reply here letting us know and we’ll verify. If we are unable to verify, It’s possible we don’t have your GitHub username or you’re using a different email address on your Git commit. Check that the CLA you previously submitted was sent to us using the email address associated with your GitHub username and verify that your email is set on your Git commits.
Corporate signers
• Your company has a Point of Contact (POC) who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you’ve previously sent us an updated CLA, please reply here letting us know and we’ll verify.
• The email used to register you as an authorized contributor must be the email used for the Git commit.
• The email used to register you as an authorized contributor must also be attached to your GitHub account.

@earthiverse
Copy link
Contributor Author

CLA signed and sent!

@earthiverse
Copy link
Contributor Author

@sheetal-purple @webkod3r Sorry for the tag, but is there any chance that this could be looked at?
This is blocking us from upgrading to PHP 8.2.

Also, I was wondering if CODEOWNERS is up-to-date.

@webkod3r
Copy link
Contributor

@sheetal-purple @webkod3r Sorry for the tag, but is there any chance that this could be looked at? This is blocking us from upgrading to PHP 8.2.

Also, I was wondering if CODEOWNERS is up-to-date.

Hello @earthiverse I'm currently out of office but I'll redirect this to proper channels to get this fixed.
Lastly, you are correct. The list of code owners is not up to date.

@olsp
Copy link

olsp commented Jun 11, 2024

Hi. I wanted to ask what the status of this is? It seems like https://github.com/mailchimp/mailchimp-marketing-php hasn't been updated yet.

@webkod3r
Copy link
Contributor

Hi. I wanted to ask what the status of this is? It seems like https://github.com/mailchimp/mailchimp-marketing-php hasn't been updated yet.

Hi @olsp, I'm working supporting the Transactional API both for PHP as well as Javascript. I've communicated this concern to the team taking care of marketing API. I'll chat with them today. Please accept my apologies on behalf of them.

@dregad
Copy link

dregad commented Jun 15, 2024

Thanks @webkod3r for your support. Did you get any feedback from the team ?

As mentioned, this is blocking upgrade to PHP 8.2, which was released 1 year, 6 months ago so it would be much appreciated if Mailchimp could keep this library up-to-date with currently supported PHP releases, particularly when the only thing needed is merging a community-provided pull request.

@dregad
Copy link

dregad commented Sep 6, 2024

Hello @webkod3r,

I see you've merged a PR back in July which, according to #363 (comment), should fix this issue. Many thanks for that !

Unfortunately the change is still not available today, because mailchimp-marketing-php has not been updated (the latest commit as of this writing is still mailchimp/mailchimp-marketing-php@c1a38f7 (Update mailchimp-marketing-php to v3.0.80), committed 2 years ago.

It would be awesome if you guys could push the changes and release v3.0.81 including this long-awaited PHP 8.2 compatibility fix which is preventing us from upgrading our server.

Thanks in advance !

@tylerdak
Copy link

Hi @webkod3r,

Apologies for the tag, but my team is also using this package on modern versions of PHP. mailchimp-marketing-php still does not have the aforementioned code from PR #363, as it hasn't seen an update in 2 years. If possible, could mailchimp-marketing-php please be updated with this PHP 8.2 compatibility fix?

Thanks in advance!

@mejta
Copy link

mejta commented Oct 23, 2024

Hi @webkod3r, I would also like to ask you when this issue will be resolved. I appreciate any help you can provide.

@pculka
Copy link

pculka commented Oct 28, 2024

Hello, our organization needs an update, aswell. PHP 8.4 is around the corner and this fix for 8.2 is not really something overly complicated.

@amcquade
Copy link

Any updates on this ?

@dregad
Copy link

dregad commented Nov 12, 2024

@ramsey I read in another thread that you were in charge of maintaining this library. It would be greatly appreciated if you could prioritize this important compatibility issue which is preventing many users from upgrading their server. The fix is already available, you just need to merge this PR so it's really not a lot of work... Thanks in advance !

@nickjbedford
Copy link

I also require this for a web application integration that runs on PHP 8.3. Supressing E_WARNING just for this one library is not a great option. Please merge this request.

@ramsey
Copy link

ramsey commented Nov 14, 2024

I do not currently have access to this repository, so I am unable to help merge this. I will try to follow up with our open source program office to see who can help resolve this.

@benlc
Copy link

benlc commented Nov 26, 2024

Any update on this?

@MakerTim
Copy link

MakerTim commented Dec 4, 2024

index a969fb5..a4dd730 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -63,6 +63,34 @@ class Configuration
     protected $tempFolderPath;
     protected $timeout = 120;
 
+    public AccountExportApi $accountExport;
+    public AccountExportsApi $accountExports;
+    public ActivityFeedApi $activityFeed;
+    public AuthorizedAppsApi $authorizedApps;
+    public AutomationsApi $automations;
+    public BatchWebhooksApi $batchWebhooks;
+    public BatchesApi $batches;
+    public CampaignFoldersApi $campaignFolders;
+    public CampaignsApi $campaigns;
+    public ConnectedSitesApi $connectedSites;
+    public ConversationsApi $conversations;
+    public CustomerJourneysApi $customerJourneys;
+    public EcommerceApi $ecommerce;
+    public FacebookAdsApi $facebookAds;
+    public FileManagerApi $fileManager;
+    public LandingPagesApi $landingPages;
+    public ListsApi $lists;
+    public PingApi $ping;
+    public ReportingApi $reporting;
+    public ReportsApi $reports;
+    public RootApi $root;
+    public SearchCampaignsApi $searchCampaigns;
+    public SearchMembersApi $searchMembers;
+    public SurveysApi $Surveys;
+    public TemplateFoldersApi $templateFolders;
+    public TemplatesApi $templates;
+    public VerifiedDomainsApi $verifiedDomains;
+
     public function __construct()
     {
         $this->tempFolderPath = sys_get_temp_dir();

Currently fixing it by patching the lib \w composer patches
Not great but it works

@ramsey
Copy link

ramsey commented Dec 5, 2024

Hey, @MakerTim, a better solution might be to patch it with this line right above the class declaration:

#[\AllowDynamicProperties]

This will allow setting these as dynamic properties, until we can sort out a solution on the Mailchimp side.

Apologies for the delay!

@ramsey
Copy link

ramsey commented Dec 5, 2024

For those interested in patching the package, check out cweagans/composer-patches. It's not a perfect solution, but it's come in handy for me in the past, and it's marginally better than forking the repo and maintaining your own branch until the upstream gets their act together. ;-)

@dregad
Copy link

dregad commented Dec 5, 2024

until the upstream gets their act together. ;-)

/me wonders how much longer that's going to take to just merge this simple PR 🙄

@MakerTim
Copy link

MakerTim commented Dec 5, 2024

We at work discussed the 3 options; Annotation, extends on stdclass or.... just define the damm properties
And if you consider PHPstan / dead code checkers / ... (static code analyzers), they currently don't understand that these properties exists and will throw unnecessary errors or they just straight up don't do the work.

Also for backwards compatibility, they currently support now back till PHP 7.2, extending on \stdclass still follows this behavior, defining properties without a type does to. Adding properties will up the required PHP version to 7.4, what is even EOL as we speak. But adding the annotation like @ramsey suggests is upping it to 8.2, that may be a step too high at once / those who are slow to upgrade to everything new and fancy.

Our discussion ended with the "Fixing the Root Cause" instead of a 🩹bandage solution, hence the diff file with adding properties.

@ramsey
Copy link

ramsey commented Dec 6, 2024

But adding the annotation like @ramsey suggests is upping it to 8.2

Attributes start with a hash mark, which is treated as a comment in versions of PHP that do not support attributes, so using them will not require PHP 8.2.

@webkod3r webkod3r merged commit 281c7e2 into mailchimp:main Dec 11, 2024
1 check failed
@dregad
Copy link

dregad commented Dec 11, 2024

Awesome, thank you @webkod3r ! 🍾🎉

Now we just need a new release of https://github.com/mailchimp/mailchimp-marketing-php

earthiverse pushed a commit to earthiverse/mailchimp-client-lib-codegen that referenced this pull request Dec 27, 2024
add public properties for php 8.2 support
earthiverse added a commit to earthiverse/mailchimp-client-lib-codegen that referenced this pull request Dec 27, 2024
This reverts commit a4f3b8d, reversing
changes made to cc5c871.
earthiverse added a commit to earthiverse/mailchimp-client-lib-codegen that referenced this pull request Dec 27, 2024
This reverts commit a4f3b8d, reversing
changes made to cc5c871.
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

Successfully merging this pull request may close these issues.