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

Prefix all code bundled in PHAR distribution with unique namesspaces #3086

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion build.xml
Expand Up @@ -331,6 +331,20 @@
<arg value="${type}"/>
</exec>

<exec executable="${basedir}/build/tools/php-scoper" taskname="php-scoper">
<arg value="add-prefix" />
<arg value="--no-ansi" />
<arg value="--config" />
<arg path="${basedir}/build/scoper.inc.php" />
<arg value="--no-interaction" />
<arg value="--stop-on-failure" />
<arg value="--output-dir" />
<arg path="${basedir}/build/phar-prefixed" />
<arg value="--prefix" />
<arg value="PHPUnit" />
<arg path="${basedir}/build/phar" />
</exec>

<exec executable="${basedir}/build/tools/phpab" taskname="phpab" failonerror="true">
<arg value="--all" />
<arg value="--static" />
Expand Down Expand Up @@ -359,12 +373,13 @@
<arg path="${basedir}/build/phpunit-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/binary-phar-autoload.php" />
<arg path="${basedir}/build/phar" />
<arg path="${basedir}/build/phar-prefixed" />
</exec>

<chmod file="${basedir}/build/phpunit-${_version}.phar" perm="ugo+rx"/>

<delete dir="${basedir}/build/phar"/>

<delete file="${basedir}/build/binary-phar-autoload.php"/>
</target>

Expand Down
24 changes: 24 additions & 0 deletions build/scoper.inc.php
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

$whitelistClasses = [
'PHPUnit\PHPUnit\Exception',
'PHPUnit\SoapClient',
'PHPUnit\Framework\*',
'PHPUnit_Framework_MockObject_MockObject',
'SebastianBergmann\CodeCoverage\*',
'PharIo\*',
'PHP_Token*',
];

return [
'whitelist' => $whitelistClasses,
];
Binary file added build/tools/php-scoper
Binary file not shown.
14 changes: 14 additions & 0 deletions build/tools/php-scoper.pubkey
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxKi/ABhiCMn7hqH9/W0x
v2WKZDtUTDoSFRMl3WMBRL0wEmwvEajOJkzgAZLLomg6DCGrH7dSgZXBaxWyq1yY
efw1qj9HcFlRs82Y8OfzdDRGDbRobERXH+sulukN0Su7jADOJHyILlQgc64Zql2J
+BXQbBXJGIeoVk3I1hKg6GALpoA5kfFMw3l8FztKiRFcBMSRdeFQJlcsB/FCXnfN
LJMnaB2LJnnV6eTj4xD3dXrKky8KxBKMxrryxNFcXqMMfL5gBdaU6CH4VUn5yPDs
R/1KBsCgTmnFY6QmRlp+kI1ogmS5Eqk66xs5WBmuCHeB+phP7CFwvfF4kFGIGITl
5nKMJ7GJWG9CFEbPlZAcfgK3e12NyHuX+XUoc94IxbfzvcWxC/ZiuFSOAbTG95ut
Ue51KkeIxq0GmW8djFySSJM4PZbPHtr7b2LhkJzjQ66dXWyTJjqxZRskmKQota6o
qe8YWALClKLaG+LYM7ZFC4Q6fb4gs1x05feucbmuiWboeJyfL/CmoafnB6MqYXxX
DXXJhMWYbrTZuawNXUe/WhEQIdiGJsoI61y7DgvKw6ExdnelIakAO9EOfkffY5wE
KVZf+2kuEqm5UPvKmwozp/g/WmMAEEn6OJbHxeqKX7Ds/eLFiE2WlZm1YO3/JNbF
HshwDz0FnMzwQom3CiykuOsCAwEAAQ==
-----END PUBLIC KEY-----