8000 scope isolation for user includes by nicolas-grekas · Pull Request #2667 · composer/composer · GitHub
[go: up one dir, main page]

Skip to content

scope isolation for user includes #2667

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

Merged
merged 1 commit into from
Feb 5, 2014
Merged

Conversation

nicolas-grekas
Copy link
Contributor

Prevents access to $this/self from included files.

< 8000 div data-view-component="true">
@@ -15,6 +15,8 @@ function includeIfExists($file)
return file_exists($file) ? include $file : false;
}

includeIfExists(__DIR__.'/../src/Composer/Autoload/ClassLoader.php');
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to use includeIfExists here. It will always exist as it is in the repo.

and no need to use ../src/ as __DIR__ is already the src folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, fixed

@naderman
Copy link
Member
naderman commented Feb 5, 2014

Build fails because of function redefinition.

@nicolas-grekas
Copy link
Contributor Author

Fixed

@naderman
Copy link
Member
naderman commented Feb 5, 2014

@stof You see any issues with this? I don't really see what the big deal with being able to access $this theoretically is, but this is fine by me too.

@stof
Copy link
Contributor
stof commented Feb 5, 2014

It looks fine to me.
The only issue I see is the pain for people who have a global composer install as well as a local one, as they would need to take care to rebuild the global autoloader to avoid issues (using the outdated global autoloader not defining the function would create weird issues if the local autoloading needing the function in autoload_real is loaded in the same process). But this is true for any upgrade of the ClassLoader (the introduction of PSR-4 for instance). I consider it is fine

@naderman
8000 Copy link
Member
naderman commented Feb 5, 2014

Yeah I think that we can live with, so merging this.

naderman added a commit that referenced this pull request Feb 5, 2014
scope isolation for user includes
@naderman naderman merged commit aef0483 into composer:master Feb 5, 2014
*/
function includeFile()
{
include func_get_arg(0);
Copy link
Member

Choose a reason for hiding this comment

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

Err now that I think about it, i forgot to comment on this, why doesn't this function just have a proper parameter?

Copy link
Member

Choose a reason for hiding this comment

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

Guess I can answer that myself, to keep the scope empty :)

Copy link
Contributor

Choose a reason for hiding this comment

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

exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0