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

[HttpKernel] Support unknown format in LoggerDataCollector#22961

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

Closed
linaori wants to merge1 commit intosymfony:3.3fromlinaori:fix/compiler-logs
Closed

[HttpKernel] Support unknown format in LoggerDataCollector#22961

linaori wants to merge1 commit intosymfony:3.3fromlinaori:fix/compiler-logs

Conversation

@linaori
Copy link
Contributor

@linaorilinaori commentedMay 30, 2017
edited
Loading

QA
Branch?3.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#22952
LicenseMIT
Doc PR~

The new expected format for the compiler log isCompilerPassClass: Message. However, this is not enforced by the old logging method as seen inschmittjoh/JMSDiExtraBundle#276

This PR adds the ability to read those lines without crashing withUncaught Notice: Undefined offset: 1.

Please note that I have not tested this in an application so testers are welcome to confirm this fix!

NicolasDievart reacted with thumbs up emoji
if (false !== ($pos =strpos($log,':')) &&$pos !== (strlen($log) -1)) {
list($pass,$message) =explode(':',$log,2);
}else {
$pass ='Unknown Compiler Pass';

Choose a reason for hiding this comment

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

what about something like:

$log =explode(':',$log,2);if (!isset($log[1]) || !class_exists($log[0],false)) {$log =array('Unknown Compiler Pass',implode(':',$log));}

z38 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.

@nicolas-grekas this seems flaky due to disabling autoloading on the class_exists (becomes unknown). As this logging is aggregated during a run-time request, I can imagine the classes to never exist in the first place.

It works fine if I allow autoloading and I don't think this should be an issue for dev

$logs =array();
foreach (file($file,FILE_IGNORE_NEW_LINES)as$log) {
$log =explode(':',$log,2);
if (!isset($log[1]) || !class_exists($log[0])) {

Choose a reason for hiding this comment

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

let's do it with a regexp instead of class_exists?
|| !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That seems to work!

@fabpot
Copy link
Member

Thank you@iltar.

@fabpotfabpot closed thisMay 31, 2017
fabpot added a commit that referenced this pull requestMay 31, 2017
… (iltar)This PR was merged into the 3.3 branch.Discussion----------[HttpKernel] Support unknown format in LoggerDataCollector| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#22952| License       | MIT| Doc PR        | ~The new expected format for the compiler log is `CompilerPassClass: Message`. However, this is not enforced by the old logging method as seen inschmittjoh/JMSDiExtraBundle#276This PR adds the ability to read those lines without crashing with `Uncaught Notice: Undefined offset: 1`.Please note that I have not tested this in an application so testers are welcome to confirm this fix!Commits-------a8dfbb1 Support unknown compiler log format
@fabpotfabpot mentioned this pull requestJun 5, 2017
@linaorilinaori deleted the fix/compiler-logs branchFebruary 8, 2019 13:38
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

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

5 participants

@linaori@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp