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

fix crash in <PHP8 with ResourceBundle #8416

Merged
merged 2 commits into from Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dictionaries/CallMap_80_delta.php
Expand Up @@ -214,7 +214,7 @@
'new' => ['bool', 'typelib_name'=>'string', 'case_insensitive='=>'true'],
],
'count' => [
'old' => ['int', 'value'=>'Countable|array|SimpleXMLElement|ResourceBundle', 'mode='=>'int'],
'old' => ['int', 'value'=>'Countable|array|SimpleXMLElement', 'mode='=>'int'],
'new' => ['int', 'value'=>'Countable|array', 'mode='=>'int'],
],
'count_chars' => [
Expand Down
2 changes: 1 addition & 1 deletion dictionaries/CallMap_historical.php
Expand Up @@ -10085,7 +10085,7 @@
'copy' => ['bool', 'from'=>'string', 'to'=>'string', 'context='=>'resource'],
'cos' => ['float', 'num'=>'float'],
'cosh' => ['float', 'num'=>'float'],
'count' => ['int', 'value'=>'Countable|array|SimpleXMLElement|ResourceBundle', 'mode='=>'int'],
'count' => ['int', 'value'=>'Countable|array|SimpleXMLElement', 'mode='=>'int'],
'count_chars' => ['array<int,int>|false', 'input'=>'string', 'mode='=>'0|1|2'],
'count_chars\'1' => ['string|false', 'input'=>'string', 'mode='=>'3|4'],
'crack_check' => ['bool', 'dictionary'=>'', 'password'=>'string'],
Expand Down
8 changes: 7 additions & 1 deletion tests/Internal/Codebase/InternalCallMapHandlerTest.php
Expand Up @@ -519,7 +519,13 @@ public function testIgnoresAreSortedAndUnique(): void
/** @var string */
$function = is_int($key) ? $value : $key;

$this->assertGreaterThan(0, strcmp($function, $previousFunction));
$diff = strcmp($function, $previousFunction);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this on purpose? Won't PHPUnit scream if there are outputs in a 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.

Yes. Because the error message with just the assert is useless, as it doesn't tell you which function is duplicate/in wrong order.

Yes, phpunit will give an error IF there is output - but that's the purpose of this - if it will fail the assertGreaterThan anyway, it might as well just tell me which function causes it to fail, so I can easily fix it.

if ($diff <= 0) {
// faster debugging errors in tests
echo "\n" . $previousFunction . "\n" . $function . "\n";
}

$this->assertGreaterThan(0, $diff);
$previousFunction = $function;
}
}
Expand Down