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] Url encoded deprecations helper config#29211

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 commentedNov 13, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#28048
LicenseMIT
Doc PRsymfony/symfony-docs#10701

First stab at implementing a new way of configuring the deprecation error handler. Includes a refactoring to keep things manageable.

Rework of#24867, blocked by#29718

TODO:

  • make the code 5.5 compatible 😢
  • add more tests
  • deprecate modes (using echo :P)
  • test this on real life projects and add some screenshots
  • docs PR
  • handlestrict
  • adapt existing CI config

Quiet configuration

quiet

Default configuration

verbose

@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch 2 times, most recently from308d9b0 to586053aCompareNovember 13, 2018 22:41
@nicolas-grekasnicolas-grekas added this to thenext milestoneNov 14, 2018
@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch 6 times, most recently fromd010f02 to4c7adb1CompareNovember 24, 2018 13:37
@ostrolucky
Copy link
Contributor

make the code 5.5 compatible cry

Why when you are targetting master?

@greg0ire
Copy link
ContributorAuthor

IIRC that's because recent versions of the bridge will be used to test old versions of other Symfony components:

"php":">=5.3.3 EVEN ON LATEST SYMFONY VERSIONS TO ALLOW USING",
"php":"THIS BRIDGE WHEN TESTING LOWEST SYMFONY VERSIONS.",
"php":">=5.3.3"

ostrolucky and sstok reacted with thumbs up emoji

@greg0ire
Copy link
ContributorAuthor

Wait@nicolas-grekas , is it really 5.3, not 5.5? Did you maybe tell me we could bump to 5.5?

@nicolas-grekas
Copy link
Member

5.5 will be good soon because 2.8 will be out of maintenance in 1 week.
We'll have to bump that 5.3 in Symfony 4.3

greg0ire and Simperfit reacted with thumbs up emojisstok reacted with hooray emoji

@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch 6 times, most recently fromeea83c2 to9c62a77CompareNovember 25, 2018 17:02
@greg0ire
Copy link
ContributorAuthor

greg0ire commentedNov 25, 2018
edited
Loading

Here is how the "Improve stack trace display" commit changes things:

Before

#0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler::Symfony\Bridge\PhpUnit\{closure}(16384, 'The Sonata\\Core...', '/home/greg/dev/...', 17, Array)#1 /home/greg/dev/SonataAdminBundle/vendor/sonata-project/core-bundle/src/Model/Adapter/AdapterInterface.php(17): trigger_error('The Sonata\\Core...', 16384)#2 /home/greg/dev/SonataAdminBundle/vendor/composer/ClassLoader.php(444): include('/home/greg/dev/...')#3 /home/greg/dev/SonataAdminBundle/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/home/greg/dev/...')#4 [internal function]: Composer\Autoload\ClassLoader->loadClass('Sonata\\CoreBund...')#5 /home/greg/dev/SonataAdminBundle/tests/Admin/AdminTest.php(1817): spl_autoload_call('Sonata\\CoreBund...')#6 [internal function]: Sonata\AdminBundle\Tests\Admin\AdminTest->provideGetSubject()#7 phar:///home/greg/bin/phpunit/phpunit/Util/Test.php(856): ReflectionMethod->invoke(Object(Sonata\AdminBundle\Tests\Admin\AdminTest))#8 phar:///home/greg/bin/phpunit/phpunit/Util/Test.php(410): PHPUnit\Util\Test::getDataFromDataProviderAnnotation('/**\n     * @dat...', 'Sonata\\AdminBun...', 'testGetSubjectF...')#9 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(157): PHPUnit\Util\Test::getProvidedData('Sonata\\AdminBun...', 'testGetSubjectF...')#10 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(906): PHPUnit\Framework\TestSuite::createTest(Object(ReflectionClass), 'testGetSubjectF...')#11 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(397): PHPUnit\Framework\TestSuite->addTestMethod(Object(ReflectionClass), Object(ReflectionMethod))#12 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(511): PHPUnit\Framework\TestSuite->__construct(Object(ReflectionClass))#13 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(592): PHPUnit\Framework\TestSuite->addTestSuite(Object(ReflectionClass))#14 phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(618): PHPUnit\Framework\TestSuite->addTestFile('/home/greg/dev/...')#15 phar:///home/greg/bin/phpunit/phpunit/Util/Configuration.php(1139): PHPUnit\Framework\TestSuite->addTestFiles(Array)#16 phar:///home/greg/bin/phpunit/phpunit/Util/Configuration.php(988): PHPUnit\Util\Configuration->getTestSuite(Object(DOMElement), Array)#17 phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(889): PHPUnit\Util\Configuration->getTestSuiteConfiguration('')#18 phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(170): PHPUnit\TextUI\Command->handleArguments(Array)#19 phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(159): PHPUnit\TextUI\Command->run(Array, true)#20 /home/greg/bin/phpunit(595): PHPUnit\TextUI\Command::main()#21 {main}

After:

#0 [internal function] Symfony\Bridge\PhpUnit\DeprecationErrorHandler::Symfony\Bridge\PhpUnit\{closure}(16384, 'The Sonata\Core…', '/home/greg/dev/…', 17, Array)#1 [sonata-project/core-bundle] /home/greg/dev/SonataAdminBundle/vendor/sonata-project/core-bundle/src/Model/Adapter/AdapterInterface.php(17): ::trigger_error('The Sonata\Core…', 16384)#2 [composer] /home/greg/dev/SonataAdminBundle/vendor/composer/ClassLoader.php(444): ::include('/home/greg/dev/…')#3 [composer] /home/greg/dev/SonataAdminBundle/vendor/composer/ClassLoader.php(322): ::Composer\Autoload\includeFile('/home/greg/dev/…')#4 [internal function] Composer\Autoload\ClassLoader::loadClass('Sonata\CoreBund…')#5 [source code] /home/greg/dev/SonataAdminBundle/tests/Admin/AdminTest.php(1817): ::spl_autoload_call('Sonata\CoreBund…')#6 [internal function] Sonata\AdminBundle\Tests\Admin\AdminTest::provideGetSubject()#7 [unknown] phar:///home/greg/bin/phpunit/phpunit/Util/Test.php(856): ReflectionMethod::invoke(Object(Sonata\AdminBundle\Tests\Admin\AdminTest))#8 [unknown] phar:///home/greg/bin/phpunit/phpunit/Util/Test.php(410): PHPUnit\Util\Test::getDataFromDataProviderAnnotation('/**\n     * @dat…', 'Sonata\AdminBun…', 'testGetSubjectF…')#9 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(157): PHPUnit\Util\Test::getProvidedData('Sonata\AdminBun…', 'testGetSubjectF…')#10 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(906): PHPUnit\Framework\TestSuite::createTest(Object(ReflectionClass), 'testGetSubjectF…')#11 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(397): PHPUnit\Framework\TestSuite::addTestMethod(Object(ReflectionClass), Object(ReflectionMethod))#12 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(511): PHPUnit\Framework\TestSuite::__construct(Object(ReflectionClass))#13 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(592): PHPUnit\Framework\TestSuite::addTestSuite(Object(ReflectionClass))#14 [unknown] phar:///home/greg/bin/phpunit/phpunit/Framework/TestSuite.php(618): PHPUnit\Framework\TestSuite::addTestFile('/home/greg/dev/…')#15 [unknown] phar:///home/greg/bin/phpunit/phpunit/Util/Configuration.php(1139): PHPUnit\Framework\TestSuite::addTestFiles(Array)#16 [unknown] phar:///home/greg/bin/phpunit/phpunit/Util/Configuration.php(988): PHPUnit\Util\Configuration::getTestSuite(Object(DOMElement), Array)#17 [unknown] phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(889): PHPUnit\Util\Configuration::getTestSuiteConfiguration('…')#18 [unknown] phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(170): PHPUnit\TextUI\Command::handleArguments(Array)#19 [unknown] phar:///home/greg/bin/phpunit/phpunit/TextUI/Command.php(159): PHPUnit\TextUI\Command::run(Array, true)#20 [source code] /home/greg/bin/phpunit(595): PHPUnit\TextUI\Command::main()

The package name is now included, which helps me. Tell me if you do not like it, and I will remove it just before this is merged.

@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch from9c62a77 to14fd0e1CompareNovember 25, 2018 17:14
@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch 8 times, most recently from9251b1a to1006b12CompareApril 11, 2019 20:55
@greg0iregreg0ireforce-pushed theurl_encoded_deprecations_helper_config branch from1006b12 to1c73f9cCompareApril 11, 2019 21:11
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.

Nice, thanks! This will improve a lot the semantics and the flexibility!

greg0ire reacted with hooray emojigreg0ire reacted with rocket emoji
@fabpot
Copy link
Member

Thank you@greg0ire.

greg0ire reacted with heart emoji

@fabpotfabpot merged commit1c73f9c intosymfony:masterApr 12, 2019
fabpot added a commit that referenced this pull requestApr 12, 2019
… (greg0ire)This PR was merged into the 4.3-dev branch.Discussion----------[PhpUnitBridge] Url encoded deprecations helper config| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#28048| License       | MIT| Doc PR        |symfony/symfony-docs#10701First stab at implementing a new way of configuring the deprecation error handler. Includes a refactoring to keep things manageable.Rework of#24867, blocked by#29718TODO:- [x] make the code 5.5 compatible 😢- [x] add more tests- [x] deprecate modes (using echo :P)- [x] test this on real life projects and add some screenshots- [x] docs PR- [x] handle `strict`- [x] adapt existing CI config# Quiet configuration![quiet](https://user-images.githubusercontent.com/657779/49341318-fa78c900-f64b-11e8-9504-a8a9eac4baf8.png)# Default configuration![verbose](https://user-images.githubusercontent.com/657779/49341322-10868980-f64c-11e8-9d90-dc3f6a18c335.png)Commits-------1c73f9c [PhpUnitBridge] Url encoded deprecations helper config
returnfalse !==strpos($key,'Count') &&false ===strpos($key,'legacy');
},ARRAY_FILTER_USE_KEY);

if (array_sum($deprecationCounts) >$this->thresholds['total']) {
Copy link
Member

Choose a reason for hiding this comment

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

this is broken if there is no such threshold

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

It is always initialized to 999999, see the ctor

returnfalse;
}
foreach (['self','direct','indirect']as$deprecationType) {
if ($deprecationCounts['remaining'.$deprecationType.'Count'] >$this->thresholds[$deprecationType]) {
Copy link
Member

Choose a reason for hiding this comment

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

this is broken if there is no such threshold

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

same as above

@greg0iregreg0ire deleted the url_encoded_deprecations_helper_config branchApril 12, 2019 11:41
nicolas-grekas added a commit that referenced this pull requestApr 12, 2019
This PR was merged into the 4.3-dev branch.Discussion----------[PhpUnitBridge] fixes| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Fixes@stof's review in#29211 + fixes PHP5.5 support (array consts are PHP5.6+)/cc@greg0ireCommits-------b11585e [PhpUnitBridge] fixes
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
}

$trace =debug_backtrace();
$deprecation =newDeprecation($msg,debug_backtrace(),$file);
Copy link
Contributor

Choose a reason for hiding this comment

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

$msg is unserialized in Deprecation constructor but unserialized message is not used by DeprecationErrorHandler. Tried to fix it in#31382

nicolas-grekas added a commit that referenced this pull requestMay 5, 2019
…nErrorHandler refacto (l-vo)This PR was merged into the 4.3-dev branch.Discussion----------[PhpunitBridge] Fix not unserialized logs after DeprecationErrorHandler refacto| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |During the refactoring for#29211 , it seems a little bug was introduced. When using runInSeparateProcess, deprecation message isn't unserialized anymore.Commits-------f522729 [PhpunitBridge] Fix not unserialized logs after DeprecationErrorHandler refactoring
@fabpotfabpot mentioned this pull requestMay 9, 2019
}

returnfalse;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@greg0ire what is the goal of this method please ? Is it only used for the color of the deprecation text or I missed another usage ? I saw some minors problems (see#31478 (WIP)). When usingrunInSeparateProcess, it's not the correct stack trace that is used to determineisIndirect result. I'm not sure how fix it. In some cases, I will not be able to serialize the deprecation original stack trace (when there is a closure). What would be (from your point of view) the consequences if isIndirect can't be determined ?

Copy link
ContributorAuthor

@greg0iregreg0ireMay 11, 2019
edited
Loading

Choose a reason for hiding this comment

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

The goal is to help making a difference between direct and indirect. If the result is inaccurate, a test suite might fail when it should not and vice versa. I'm on hols, and answering from my phone while walking in the street so my answer might be inaccurate too :P

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

IIRC there is a group of "others" deprecations, maybe we should throw an exception when unable to answer, and catch it and then put the deprecation in that group

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought too about this kind of solution. To accept to not be able to determine direct/indirect in some edge cases (runInSeparateProcess and unserializable trace in this case). Thank you for your help 👍

greg0ire reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

See implementation of this kind of solution here:#31730

javiereguiluz pushed a commit to symfony/symfony-docs that referenced this pull requestMay 31, 2019
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestMay 31, 2019
…ire, llaakkkk)This PR was submitted for the master branch but it was merged into the 4.3 branch instead (closes#11323).Discussion----------Document changes in the deprecation error handlerSeesymfony/symfony#29211Seesymfony/symfony#28048Closes#10701Commits-------64141fc fixup! Document changes in the deprecation error handlerdd7eb0b fixup! Document changes in the deprecation error handlerb2a7744 fixup! Document changes in the deprecation error handler988badf fixup! Document changes in the deprecation error handler2a750ea Document changes in the deprecation error handler
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

+1 more reviewer

@l-vol-vol-vo left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

8 participants

@greg0ire@ostrolucky@nicolas-grekas@fabpot@stof@OskarStark@l-vo@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp