Skip to content

Have weak_vendors ignore deprecations from outside #24864

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
Jan 21, 2018

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Nov 7, 2017

phar:// and eval() can execute code that may or may not come from the vendors.

Q A
Branch? 3.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? not yet
Fixed tickets #24853
License MIT

I haven't managed to get the phar test to pass yet, but before I do, is it ok for me to commit a test phar in Symfony? I'm thinking trust issues? Although the phar is almost plain text.

Next, I'm stuck because it looks like symfony does not know how to load classes anymore... should I somehow load vendor/autoload.php from the phar or something like that? solved, had nothing to do with that.

@greg0ire
Copy link
Contributor Author

greg0ire commented Nov 7, 2017

Wait wut? It passes on some versions of php??? I thought it wouldn't pass at all...

@sroze
Copy link
Contributor

sroze commented Nov 7, 2017

Nop, just that some version of PHP are skipped for pull-requests. See the logs of the successful ones.

@greg0ire
Copy link
Contributor Author

greg0ire commented Nov 7, 2017

Thanks @sroze , things make sense again thanks to you!

@greg0ire greg0ire force-pushed the ignore_deprecations_from_phar branch 2 times, most recently from 3f43275 to d2371fa Compare November 8, 2017 21:59
@greg0ire greg0ire changed the title WIP: Have weak_vendors ignore deprecations from outside Have weak_vendors ignore deprecations from outside Nov 8, 2017
@greg0ire
Copy link
Contributor Author

greg0ire commented Nov 8, 2017

Ok so now the build only fails on 7.2... with deps=low

@greg0ire
Copy link
Contributor Author

greg0ire commented Nov 8, 2017

Could it be become of the phpunit-bridge vendor interfering? I can see it being installed : https://travis-ci.org/symfony/symfony/jobs/299336081#L942

@soullivaneuh
Copy link
Contributor

As a bug fix, it should be merged on 3.3: https://symfony.com/roadmap?version=3.3#checker

Should not be?

@greg0ire
Copy link
Contributor Author

That's correct, let me rebase.

@greg0ire greg0ire force-pushed the ignore_deprecations_from_phar branch from d2371fa to 8f8d5f4 Compare November 10, 2017 15:44
@greg0ire greg0ire changed the base branch from 3.4 to 3.3 November 10, 2017 15:44
@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Nov 10, 2017
@greg0ire
Copy link
Contributor Author

Tests are failing probably because

the script used to run tests is installing the latest version of the PHPUnit Bridge, which does not yet have this feature.

See #24867 (comment)

I'm afraid there is nothing I can do about that. Is there hope to get this merged nonetheless?

@@ -75,9 +75,12 @@ public static function register($mode = 0)
}
}
}
$path = realpath($path) ?: $path;
$realPath = realpath($path);
if (false === $realPath && '-' !== $path) {
Copy link
Member

Choose a reason for hiding this comment

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

I think - has changed on 7.2, the string is different

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dang, good catch! I knew this was a bit fragile but don't know what else to use, will have to give it more thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to docker I now know this could be "Standard input code"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't think of a less fragile solution though.

@greg0ire greg0ire force-pushed the ignore_deprecations_from_phar branch from 8f8d5f4 to d378244 Compare December 7, 2017 20:50
@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 7, 2017

Not sure it's that string you were thinking about @nicolas-grekas : here is the change : php/php-src@3ed8b7a , and it does not change from -, but from php://stdin.

@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 9, 2017

Ok so now I am sure, tried the code with:

docker run -it -v $PWD:/tmp/sf php:7.2-cli-alpine3.6 /bin/sh
cd /tmp/sf
curl -sSL https://phar.phpunit.de/phpunit.phar > phpunit
chmod +x phpunit
phpunit src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/

And then confirmed with some var_dump statements.

@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 9, 2017

I just confirmed the tests pass on 5.5 by using

docker run -it -v $PWD:/tmp/sf melkorm/php-5.5-cli-with-extensions /bin/sh
php -d memory_limit=-1 /usr/local/bin/composer update
curl -sSL https://phar.phpunit.de/phpunit-4.8.9.phar>phpunit
chmod +x phpunit
./phpunit src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler

@greg0ire
Copy link
Contributor Author

fabbot seems stuck, let's close and reopen

@greg0ire greg0ire closed this Dec 16, 2017
@greg0ire greg0ire reopened this Dec 16, 2017
@greg0ire
Copy link
Contributor Author

Please review again

@greg0ire
Copy link
Contributor Author

greg0ire commented Jan 2, 2018

ping @nicolas-grekas

@greg0ire greg0ire force-pushed the ignore_deprecations_from_phar branch from d378244 to 6580c38 Compare January 5, 2018 18:38
@greg0ire
Copy link
Contributor Author

greg0ire commented Jan 5, 2018

I added a script to regenerate the phar, so that it's easier to understand or maintain.

phar:// and eval() can execute code that may or may not come from the vendors.
@greg0ire greg0ire force-pushed the ignore_deprecations_from_phar branch from f776108 to 9ce0ae2 Compare January 21, 2018 18:42
@nicolas-grekas
Copy link
Member

Thank you @greg0ire.

@nicolas-grekas nicolas-grekas merged commit 9ce0ae2 into symfony:3.3 Jan 21, 2018
nicolas-grekas added a commit that referenced this pull request Jan 21, 2018
This PR was merged into the 3.3 branch.

Discussion
----------

Have weak_vendors ignore deprecations from outside

phar:// and eval() can execute code that may or may not come from the vendors.

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | not yet
| Fixed tickets | #24853
| License       | MIT

I haven't managed to get the phar test to pass yet, but before I do, is it ok for me to commit a test phar in Symfony? I'm thinking trust issues? Although the phar is almost plain text.

~~Next, I'm stuck because it looks like symfony does not know how to load classes anymore... should I somehow load `vendor/autoload.php` from the phar or something like that?~~ solved, had nothing to do with that.

Commits
-------

9ce0ae2 Have weak_vendors ignore deprecations from outside
@greg0ire greg0ire deleted the ignore_deprecations_from_phar branch January 21, 2018 18:50
This was referenced Jan 29, 2018
greg0ire added a commit to sonata-project/dev-kit that referenced this pull request Mar 6, 2018
This reverts commit e103e32.
The issues with this mode have been fixed and are released.
See symfony/symfony#24864
soullivaneuh pushed a commit to sonata-project/dev-kit that referenced this pull request May 5, 2018
This reverts commit e103e32.
The issues with this mode have been fixed and are released.
See symfony/symfony#24864
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.

6 participants