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

lots of warnings about function declarations #2

Closed
RobertP3469 opened this issue Jan 17, 2017 · 9 comments
Closed

lots of warnings about function declarations #2

RobertP3469 opened this issue Jan 17, 2017 · 9 comments
Labels
Resolved Acceptance criteria for resolution was met.

Comments

@RobertP3469
Copy link

Backtrace from warning 'Declaration of Campaigns_Feedback::POST() should be compatible with Campaigns::POST($type, $settings = Array, $optional_parameters = Array)' at \mailchimp-api-3-0-php\campaigns\campaignsFeedback.php 64:

Backtrace from warning 'Declaration of Campaigns_Feedback::PATCH() should be compatible with Campaigns::PATCH($params = Array)' at \mailchimp-api-3-0-php\campaigns\campaignsFeedback.php 64:

Backtrace from warning 'Declaration of Ecommerce_Customers::POST() should be compatible with Ecommerce_Stores::POST($storeid, $listid, $name, $currencycode, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\ecommerceStoresCustomers.php 96:

Backtrace from warning 'Declaration of Ecommerce_Store_Carts::POST() should be compatible with Ecommerce_Stores::POST($storeid, $listid, $name, $currencycode, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\carts\ecommerceStoresCartsRoot.php 94:

Backtrace from warning 'Declaration of Ecommerce_Stores_Cart_Lines::POST() should be compatible with Ecommerce_Store_Carts::POST($cartid, $customer, $currency_code, $order_total, $lines, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\carts\ecommerceStoresCartLines.php 71:

Backtrace from warning 'Declaration of Ecommerce_Stores_Orders::POST() should be compatible with Ecommerce_Stores::POST($storeid, $listid, $name, $currencycode, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\orders\ecommerceStoresOrdersRoot.php 99:

Backtrace from warning 'Declaration of Ecommerce_Stores_Order_Lines::POST() should be compatible with Ecommerce_Stores_Orders::POST($orderid, $customer, $currency_code, $order_total, $lines, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\orders\ecommerceStoresOrderLines.php 72:

Backtrace from warning 'Declaration of Ecommerce_Stores_Products::POST() should be compatible with Ecommerce_Stores::POST($storeid, $listid, $name, $currencycode, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\products\ecommerceStoresProductsRoot.php 92:

Backtrace from warning 'Declaration of Ecommerce_Stores_Products_Variants::POST() should be compatible with Ecommerce_Stores_Products::POST($productid, $title, $variants = Array, $optional_parameters = Array)' at \mailchimp-api-3-0-php\ecommerceStores\products\ecommerStoresProductVariants.php 91:

Backtrace from warning 'Declaration of Lists_Merge_Fields::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\listsMergeFields.php 68:

Backtrace from warning 'Declaration of Lists_Merge_Fields::PATCH() should be compatible with Lists::PATCH($patch_params = NULL)' at \mailchimp-api-3-0-php\lists\listsMergeFields.php 68:

Backtrace from warning 'Declaration of Lists_Signup_Forms::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\listsSignupForms.php 40:

Backtrace from warning 'Declaration of Lists_Webhooks::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\listsWebhooks.php 59:

Backtrace from warning 'Declaration of Lists_Interest_Categories::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\interestCategories\listsInterestsCategoriesRoot.php 82:

Backtrace from warning 'Declaration of Lists_Interest_Categories::PATCH() should be compatible with Lists::PATCH($patch_params = NULL)' at \mailchimp-api-3-0-php\lists\interestCategories\listsInterestsCategoriesRoot.php 82:

Backtrace from warning 'Declaration of Lists_Interests_Categories_Interest::POST() should be compatible with Lists_Interest_Categories::POST($title, $type)' at \mailchimp-api-3-0-php\lists\interestCategories\listsInterestsCategroiesInterests.php 66:

Backtrace from warning 'Declaration of Lists_Interests_Categories_Interest::PATCH() should be compatible with Lists_Interest_Categories::PATCH($title, $type)' at \mailchimp-api-3-0-php\lists\interestCategories\listsInterestsCategroiesInterests.php 66:

Backtrace from warning 'Declaration of Lists_Members::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\members\listsMembersRoot.php 129:

Backtrace from warning 'Declaration of Lists_Members_Member_Notes::POST() should be compatible with Lists_Members::POST($status, $emailaddress, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\members\listsMembersMemberNotes.php 67:

Backtrace from warning 'Declaration of Lists_Members_Member_Notes::PATCH() should be compatible with Lists_Members::PATCH($patch_parameters = Array)' at \mailchimp-api-3-0-php\lists\members\listsMembersMemberNotes.php 67:

Backtrace from warning 'Declaration of Lists_Segments::POST() should be compatible with Lists::POST($name, $reminder, $emailtype, $company, $address_street, $address_street2, $address_city, $address_state, $address_zip, $country, $from_name, $from_email, $subject, $language, $optional_parameters = Array)' at \mailchimp-api-3-0-php\lists\segments\listsSegmentsRoot.php 103:

Backtrace from warning 'Declaration of Lists_Segments::PATCH() should be compatible with Lists::PATCH($patch_params = NULL)' at \mailchimp-api-3-0-php\lists\segments\listsSegmentsRoot.php 103:

Backtrace from warning 'Declaration of Lists_Segment_Segment_Members::POST() should be compatible with Lists_Segments::POST($name, $conditions = NULL, $static_segment = NULL)' at \mailchimp-api-3-0-php\lists\segments\listsSegmentsSegmentMembers.php 54:

@Jhut89
Copy link
Owner

Jhut89 commented Jan 18, 2017

Hello @RobertP3469!

#1. You are awesome for checking out this repository! 💯 👍

#2. Taking a look at these Strict Standards warnings you are seeing, it looks like these are from PHP not liking a child class having a method with an identical name to a parent's method that takes different input. So in this case Lists_Members::POST() is generating a warning because Lists::POST() takes different input. These functions take different input by design because they are posting to separate endpoints which expect different parameters. Clearly PHP does not like this though so I will look for a way to get these warnings off the table. If you have any ideas please be sure to throw them my way!

That being said the library should still be usable even with these warnings while I look for a good way get rid of them! Also it appears that PHP 7 did away with E_STRICT. I don't think you would see these warnings on earlier versions outside of strict mode.

Best,
Hutch

@RobertP3469
Copy link
Author

I tried making a list request, and I keep getting null as a response.

@Jhut89
Copy link
Owner

Jhut89 commented Jan 18, 2017

@RobertP3469 I'd be happy to take a look at it with you. Mind sharing your code (minus your API key)?

@RobertP3469
Copy link
Author

Here's the plugin code I'm working on.
You will need to modify index.php so that your library is loaded and the other MailChimp wrapper class is not loaded.
The testing was being done in the display() function of rdpBCGAdmin_Mapping.php.
Also, I modified your Mailchimp class, by adding a verify_ssl property, like the other MailChimp wrapper class has, and then I modified the curl functions to utilize the verify_ssl property.
My development environment: IIS 7, PHP 5.5.30, WP 4.4.6

rdp-buddychimp-groups.zip

@Jhut89
Copy link
Owner

Jhut89 commented Jan 18, 2017

@RobertP3469 Thanks for that!

Could you try replacing return json_decode($this->response, false); with just return $this->response; in the curl functions in mailchimpRoot.php and see if you still get a null value. I have a feeling that whats being returned is not valid JSON hence you are seeing NULL returned. Can you let me know if you are seeing a change after that?

I am successfully making calls against list endpoint in my environment. Although I admittedly don't have a wordpress testing environment to try and replicate exactly.

I'm going to add a To-Do for some logic to keep that JSON encode thing from happening in the future. Shouldn't be a huge change.

As well after thinking about it last night I'm likely going to implement a refactor to take care of those PHP warnings. I'm going to move all Verb methods for each endpoint into the Mailchimp class and leave a list of required params in each class for each method. I'm still working out the nitty gritty of it but this is likely going to be a larger refactor.

Lemme know what you see after replacing that code!

Best,
Hutch

@Jhut89
Copy link
Owner

Jhut89 commented Jan 18, 2017

Also I like your implementation for verify_ssl mind if I use it (or if you want credit mind opening a PR)? Once we have worked out whats going on.

@Jhut89
Copy link
Owner

Jhut89 commented Jan 19, 2017

@RobertP3469 Still with me here?

@RobertP3469
Copy link
Author

yep.. kinda busy

@Jhut89
Copy link
Owner

Jhut89 commented Jan 20, 2017

@RobertP3469 All good when you do get a sec check out latest version. PHP Warnings should be fixed. I'm going to go ahead and close this issue but feel free to open another should you run into anything else.

@Jhut89 Jhut89 closed this as completed Jan 20, 2017
@Jhut89 Jhut89 added the Resolved Acceptance criteria for resolution was met. label May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolved Acceptance criteria for resolution was met.
Projects
None yet
Development

No branches or pull requests

2 participants