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

Double call to mb_string #16

Closed
dktcoding opened this issue Apr 25, 2020 · 0 comments
Closed

Double call to mb_string #16

dktcoding opened this issue Apr 25, 2020 · 0 comments

Comments

@dktcoding
Copy link

Hi there!

There's an issue in DiffToolkit where it's calling mb_strlen(mb_strlen($longtext)) this produces an error on newer php versions (using declare(strict_types=1)) because mb_strlen must receive a string as an argument.

After changing it all tests keep passing

if (mb_strlen($longtext) < 4 || mb_strlen($shorttext) * 2 < mb_strlen(mb_strlen($longtext))) {

Here's the previous phpunit log

PhpUnit Log

 fede@desktop ~/Codes/diff-match-patch ~ $ vendor/phpunit/phpunit/phpunit
//PHPUnit 9.1.3 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.5
Configuration: /home/fede/Codes/diff-match-patch/phpunit.xml.dist

.E.......EEE..........E.............EEEE.Elapsed time: 0.008
Memory usage: 0.144
.Elapsed time: 0.158
Memory usage: 0
..                      44 / 44 (100%)

Time: 00:00.315, Memory: 8.00 MB

There were 9 errors:

1) DiffMatchPatch\DiffMatchPatchTest::testDiffMain
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/DiffMatchPatch.php:174
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:79

2) DiffMatchPatch\DiffMatchPatchTest::testPatchMake
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/src/DiffMatchPatch.php:262
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:164

3) DiffMatchPatch\DiffMatchPatchTest::testPatchApply
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/src/DiffMatchPatch.php:262
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:176
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:188

4) DiffMatchPatch\DiffMatchPatchTest::testPatchApply_2
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/src/DiffMatchPatch.php:262
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:176
/home/fede/Codes/diff-match-patch/tests/DiffMatchPatchTest.php:196

5) DiffMatchPatch\DiffTest::testMain
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/tests/DiffTest.php:729

6) DiffMatchPatch\PatchTest::testMake
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/tests/PatchTest.php:157

7) DiffMatchPatch\PatchTest::testSplitMax
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/tests/PatchTest.php:214

8) DiffMatchPatch\PatchTest::testAddPadding
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/tests/PatchTest.php:247

9) DiffMatchPatch\PatchTest::testApply
TypeError: Argument 4 passed to DiffMatchPatch\Diff::compute() must be of the type int, float given, called in /home/fede/Codes/diff-match-patch/src/Diff.php on line 991

/home/fede/Codes/diff-match-patch/src/Diff.php:1029
/home/fede/Codes/diff-match-patch/src/Diff.php:991
/home/fede/Codes/diff-match-patch/src/Patch.php:293
/home/fede/Codes/diff-match-patch/tests/PatchTest.php:288

Regards!

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

2 participants