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

[PHPUnit Bridge]Implement poor man's error handler#21795

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

@greg0ire
Copy link
Contributor

@greg0iregreg0ire commentedFeb 28, 2017
edited
Loading

This line of code is hit when the error handler has failed. In that
case, we want to get errors in the most reliable possible way, with very
simple code. I think var_export and error_get_last are good candidates
for that.

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsnone
LicenseMIT
Doc PRnone

Here is what it looks like. I will remove the purposefully wrong commit once everyone is ok with the output. Please not that in that case, it's aphpt, so it's a bit special.
Also, to elaborate a bit on the why, if you feel like people developing on the deprecation error handler could easily add these lines and remove them after debugging their problem, bear in mind that some problems, just like the one I introduced to test this, occur on some builds only.

The problem I introduced was a mistake I made in#21539 .
To debug it I had to find the right Travis container from quay.io, set uptravis-build on it, which is quite an ordeal, and then run the generatedci.sh script.

$group ='other';

$isWeak = DeprecationErrorHandler::MODE_WEAK ===$mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS ===$mode &&$isVendor =$inVendors($file));
$isWeak = DeprecationErrorHandler::MODE_WEAK ===$mode || (self::MODE_WEAK_VENDORS ===$mode &&$isVendor =$inVendors($file));
Copy link
Member

Choose a reason for hiding this comment

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

this change is a no-go. The PHPUnit Bridge is still compatible with PHP 5.3 even in master (our own testsuite uses the newest bridge even in LTS branches)

Copy link
ContributorAuthor

@greg0iregreg0ireFeb 28, 2017
edited
Loading

Choose a reason for hiding this comment

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

@stof: this is to demonstrate the error handling, and will be removed from the PR before merging. Please read the commit messages :P

Wirone reacted with laugh emoji

Choose a reason for hiding this comment

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

Any way to showcase it in a test case?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I think that would imply isolating it in a public method. Or maybe… in a private method, and then do a bit of black magic to make it public with reflection. I'll see what I can do.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hmm… that won't be so easy since we're inside a closure, which is itself inside another closure. But the condition to run this piece of code is just to change the error handler. Let's try that.

Choose a reason for hiding this comment

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

Why focus on this specific way to trigger a failure? Aren't there "userland" side to showcase the new behavior in e.g. a phpt test case?

Copy link
ContributorAuthor

@greg0iregreg0ireFeb 28, 2017
edited
Loading

Choose a reason for hiding this comment

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

No there aren't AFAIK. I think this only happens when there is a programming error in the deprecation error handler. Should I think otherwise? I only saw it in action when (failing at) writing my other PR on this error handler, so maybe I'm missing other possible ways to trigger this piece of code?

Choose a reason for hiding this comment

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

Really? Then we don't care sorry...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Argh. Please reconsider… these few lines can save literal hours to anyone try to contribute to this error handler. I know the audience is small, but it exists.

@greg0iregreg0ire changed the titleImplement poor man's error handler[PHPUnit Bridge]Implement poor man's error handlerFeb 28, 2017
@greg0iregreg0ire mentioned this pull requestFeb 28, 2017
7 tasks
@nicolas-grekasnicolas-grekas added this to the3.3 milestoneFeb 28, 2017
This line of code is hit when the error handler has failed. In thatcase, we want to get errors in the most reliable possible way, with verysimple code. I think var_export and error_get_last are good candidatesfor that.
@greg0iregreg0ireforce-pushed thefeature/poor_mans_error_handler branch from7e2c5e8 to7832b32CompareFebruary 28, 2017 18:55
@greg0ire
Copy link
ContributorAuthor

Then we don't care sorry...

You probably know better, let's just close this.

@greg0iregreg0ire deleted the feature/poor_mans_error_handler branchMarch 1, 2017 07:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

4 participants

@greg0ire@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp