Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invoke#32933

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@karser
Copy link
Contributor

QA
Branch?4.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#32879
LicenseMIT

The PHPUnit methodhandleError was renamed to__invoke in v8.3.

So we should check in SymfonyDeprecationErrorHandler if methodhandleError exists, otherwise call__invoke

It works with phpunit v8.2.5 and 8.3.2.
The PHPUnit handler is called when I trigger some error, e.giconv('fdsfs', 'fsdfds', '');

@nicolas-grekasnicolas-grekas changed the titleFixed PHPUnit 8.3 incompatibility: method handleError was renamed to __invoke (from stacktrace)[PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invokeAug 5, 2019
@nicolas-grekasnicolas-grekas changed the base branch from4.3 to3.4August 5, 2019 10:01
@nicolas-grekasnicolas-grekasforce-pushed thephpunit83-errorhandler-fix-stacktrace branch 2 times, most recently froma505eab tob253eb6CompareAugust 5, 2019 10:05
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

(I rebased this PR for 3.4 and made some fixes)

@nicolas-grekasnicolas-grekasforce-pushed thephpunit83-errorhandler-fix-stacktrace branch fromb253eb6 to0c9539fCompareAugust 5, 2019 10:06
@karser
Copy link
ContributorAuthor

I see. Anyways I'm glad I could help you with the research part and learnt some error handling stuff. Still have one question though, why do you return afunction that returns false in getPhpUnitErrorHandler? isn't justfalse not enough in the set_error_handler callback?

@nicolas-grekas
Copy link
Member

why do you return a function that returns false in getPhpUnitErrorHandler? isn't just false not enough in the set_error_handler callback?

the return value is used withcall_user_func, returningfalse here would then break.

karser reacted with thumbs up emoji

@karser
Copy link
ContributorAuthor

Should I apply fabbot patch?
image

@nicolas-grekas
Copy link
Member

Nope, fabbot doesn't work for the bridge.

@nicolas-grekas
Copy link
Member

Thank you@karser.

mdelanoue and karser reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commit0c9539f intosymfony:3.4Aug 5, 2019
nicolas-grekas added a commit that referenced this pull requestAug 5, 2019
…ndleError was renamed to __invoke (karser)This PR was merged into the 3.4 branch.Discussion----------[PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invoke| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |#32879   <!-- #-prefixed issue number(s), if any -->| License       | MITThe PHPUnit method  [handleError](https://github.com/sebastianbergmann/phpunit/blob/8.2.5/src/Util/ErrorHandler.php#L38) was renamed to [__invoke](https://github.com/sebastianbergmann/phpunit/blob/8.3/src/Util/ErrorHandler.php#L71) in v8.3.So we should check in Symfony [DeprecationErrorHandler](https://github.com/symfony/symfony/blob/v4.3.3/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php) if method `handleError` exists, otherwise call `__invoke`It works with phpunit v8.2.5 and 8.3.2.The PHPUnit handler is called when I trigger some error, e.g `iconv('fdsfs', 'fsdfds', '');`Commits-------0c9539f [PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invoke
}

$UtilPrefix =class_exists('PHPUnit_Util_ErrorHandler') ?'PHPUnit_Util_' :'PHPUnit\Util\\';
self::$isAtLeastPhpUnit83 =method_exists('PHPUnit\Util\ErrorHandler','__invoke');
Copy link
Member

Choose a reason for hiding this comment

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

ErrorHandler::class

Copy link
Member

Choose a reason for hiding this comment

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

nvm. Didn't notice that version were 3.4

publicstaticfunctiongetPhpUnitErrorHandler()
{
if (!self::$isAtLeastPhpUnit83) {
return (class_exists('PHPUnit_Util_ErrorHandler',false) ?'PHPUnit_Util_' :'PHPUnit\Util\\').'ErrorHandler::handleError';
Copy link
Member

Choose a reason for hiding this comment

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

return [ErrorHandler::class, 'handleError'] since#32940

Copy link
Member

Choose a reason for hiding this comment

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

nvm. Didn't notice that version were 3.4

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@karser@nicolas-grekas@jderusse@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp