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

Deprecate other values than string for CreditCard #93

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

soullivaneuh
Copy link
Contributor

Fixes #75.

@@ -30,7 +30,6 @@ public function getValidCreditCards()
array('4903010000000009'), //Switch
array('4111111111111111'), //Visa
array('6304100000000008'), //Laser
array(6304100000000008), //Laser
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point of removing an existing valid test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not removed but added as invalid here: composer/composer#5249 (comment)

See #75 (comment)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's valid cannot become invalid without a strong good reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the goal of #75 discussion.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes obviously, but #75 is not about valid/invalid test dataset, but rather about valid/invalid 32bits OS. So array(6304100000000008) remains a 100% valid test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That depends of the issue finality. See #75 (comment).

If you agree that having a integer for a credit card make no sense, so this PR is the way to do.

Otherwise, I'll update or close it.

Copy link
Contributor Author

@soullivaneuh soullivaneuh May 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ronanguilloux
Copy link
Owner

ronanguilloux commented May 14, 2016

Since now, we allowed Isocode users to send integer typed credit card numbers for validation. Consider it a legacy. This PR would introduced a BC break preventing to send integers. So, cannot merge that now, no major release planned. So we put this in the fridge.

@soullivaneuh
Copy link
Contributor Author

soullivaneuh commented May 14, 2016

@ronanguilloux I could rework my PR to make it BC with a deprecation message. 👍

@soullivaneuh
Copy link
Contributor Author

BTW, it would be great to have 2.x as main branch and master for BC break things IMHO.

@soullivaneuh soullivaneuh changed the title Only accept string values for CreditCard Deprecate other values than string for CreditCard May 14, 2016
@soullivaneuh
Copy link
Contributor Author

@ronanguilloux I updated my PR on a BC way. Could you please take a look?

@soullivaneuh
Copy link
Contributor Author

Wait before merge: I think we should add an exception for 32 bits system and not pass integer values on test. Will work on it.

cc @enumag

@soullivaneuh
Copy link
Contributor Author

Done. @enumag could you please checkout my fork on your 32bits system and tell us if test passed? Thanks.

@soullivaneuh
Copy link
Contributor Author

@ronanguilloux the deprecated message produce travis fail. We should implement SYMFONY_DEPRECATIONS_HELPER=weak on it.

@soullivaneuh
Copy link
Contributor Author

soullivaneuh commented May 14, 2016

@ronanguilloux The PR is ready for me. 👍

I introduced legacy values for tests: ea8cad5

This is a smoother way than SYMFONY_DEPRECATIONS_HELPER tricks.

More info: http://symfony.com/doc/current/components/phpunit_bridge.html#mark-tests-as-legacy

@soullivaneuh
Copy link
Contributor Author

@ronanguilloux Are you planning to tag a new minor version after that?

Test for card number `6304100000000008` fails on windows because a number this long can't be stored as an integer.
Instead it becomes a float and when converted into string it is 6.3041E+15 instead of 6304100000000008.

CreditCard::validate should only allow string arguments.

This is done in a BC way and should be updated for next major.
Integer credit card fails on 32bits system because the integer is too long.

Method for 64bits detection: http://stackoverflow.com/a/5424121/1731473
@soullivaneuh
Copy link
Contributor Author

@ronanguilloux PR rebased agains master.

@soullivaneuh
Copy link
Contributor Author

@ronanguilloux Sorry for the ping, any chance to get this merged before the next minor release?

This PR is now completely BC. 👍

@enumag
Copy link
Contributor

enumag commented May 29, 2016

@soullivaneuh Actually my system and php are both x64. Can't help with 32bit.

@soullivaneuh
Copy link
Contributor Author

@ronanguilloux Does anything is missing to merge this one?

Maybe do you want to integrate AppVeyor service for Windows testing? I can provide a configuration for that.

@soullivaneuh
Copy link
Contributor Author

ping @ronanguilloux

Please tell me what do you want to do! 😉

@soullivaneuh
Copy link
Contributor Author

@ronanguilloux Can I please have any input for this? Thanks.

@ronanguilloux
Copy link
Owner

ronanguilloux commented Jan 10, 2017

@soullivaneuh everything is in the (too long) #75 conversation.

Summary: we don't support any 32 bits OS anymore. At max, you can PR a note on README

@soullivaneuh
Copy link
Contributor Author

Yes, but allowing only string is bc break.

It would be great to prevent that before the next major with a deprecation warning.

This PR is designed for that like I said in #93 (comment).

So this one can be merged now, and then remove the deprecation notice on next major.

BTW, we can support only PHP7 for next major (as 5.x is not maintained anymore) and take benefit of strict type.

Tell me. If you prefer to break the compatibility directly on next major, I'll rollback my PR modification for that and we will be able to put it on the fridge.

MaximeLC2 pushed a commit to Vigicorp/IsoCodes that referenced this pull request Aug 25, 2020
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.

None yet

3 participants