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

filter_var has different behavior in PHP 7.x #6

Open
peter279k opened this issue Jul 18, 2019 · 0 comments
Open

filter_var has different behavior in PHP 7.x #6

peter279k opened this issue Jul 18, 2019 · 0 comments

Comments

@peter279k
Copy link

Issue summary

The filter_var has the different behavior in the php-7.x versions.

System informations

  • OS: Linux/Ubuntu 18.04.2 LTS
  • PHP version: php-7.1.30

Standalone code, or other way to reproduce the problem

Please consider following code snippets firstly:

It's for php-7.x:

filter_var('not-int',  FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'default' => 20]]); // 20

It's for php-5.x:

filter_var('not-int',  FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'default' => 20]]); // false

It effects the line 229 in src/Millipede.php class.

Expected result

The tests will be done and has the green message in php-7.x.

Actual result

The tests will have the failed assertion due to different filter_var behavior in different PHP versions.

PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Runtime:	PHP 7.1.30-1+ubuntu18.04.1+deb.sury.org+1 with Xdebug 2.7.1
Configuration:	/data/millipede-php/phpunit.xml

.......F......F................................

Time: 389 ms, Memory: 6.00MB

There were 2 failures:

1) MillipedeTest\MillipedeTest::testSetSizeThrowsException
Failed asserting that exception of type "\InvalidArgumentException" is thrown.

2) MillipedeTest\MillipedeTest::testSetCurveThrowsException
Failed asserting that exception of type "\InvalidArgumentException" is thrown.

FAILURES!
Tests: 47, Assertions: 58, Failures: 2.

Once accepting this, I can solve this issue.

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

No branches or pull requests

1 participant