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

Fixed the DebugClassLoader compatibility with eval()'d code on Darwin #30363

Merged
merged 1 commit into from Feb 24, 2019

Conversation

skalpa
Copy link
Contributor

@skalpa skalpa commented Feb 24, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #30362
License MIT

When a class is defined in an eval() block, the reported file name is file_name.php(123) : eval()'d code, which prevents DebugClassLoader::darwinRealpath() from locating/normalizing the file name, and triggers a notice.

@@ -397,6 +397,10 @@ private function darwinRealpath($real)
$kFile = strtolower($file);

if (!isset($dirFiles[$kFile])) {
if (') : eval()\'d code' === substr($kFile, -17)) {
Copy link
Member

Choose a reason for hiding this comment

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

to allow the result to be cached, this should be before the previous "if", using
if (!isset($dirFiles[$kFile]) && ') : eval()\'d code' === substr($kFile, -17)) { for example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I moved it before the first isset() as it might even save the strtolower() call.

@skalpa
Copy link
Contributor Author

skalpa commented Feb 24, 2019

The AppVeyor build fail is unrelated (problem with the console ProcessHelperTest).

@nicolas-grekas
Copy link
Member

Thank you @skalpa.

@nicolas-grekas nicolas-grekas merged commit 6c2aa24 into symfony:3.4 Feb 24, 2019
nicolas-grekas added a commit that referenced this pull request Feb 24, 2019
…e on Darwin (skalpa)

This PR was squashed before being merged into the 3.4 branch (closes #30363).

Discussion
----------

Fixed the DebugClassLoader compatibility with eval()'d code on Darwin

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30362
| License       | MIT

When a class is defined in an `eval()` block, the reported file name is `file_name.php(123) : eval()'d code`, which prevents `DebugClassLoader::darwinRealpath()` from locating/normalizing the file name, and triggers a notice.

Commits
-------

6c2aa24 Fixed the DebugClassLoader compatibility with eval()'d code on Darwin
This was referenced Mar 3, 2019
nicolas-grekas added a commit that referenced this pull request Oct 15, 2020
…aknin)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Fix Reflection file name with eval()\'d code

| Q             | A
| ------------- | ---
| Branch?      | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

remove eval()\'d code from lineage
similar to #30363

Commits
-------

394a694 Fix Reflection file name with eval()\'d code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants