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

Test phpstan /w restricted open_basedir and disabled proc_open #7518

Merged
merged 1 commit into from
Jun 23, 2022
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/other-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ jobs:
cd e2e/rector-autoload
composer install
../../phpstan
- |
cd e2e/restricted-php-ini
composer install
php -d open_basedir="$(cd ../.. && pwd):$(php -r 'echo sys_get_temp_dir();')" -d disable_functions="pcntl_exec,pcntl_fork,exec,passthru,proc_open,shell_exec,system,popen" -d auto_prepend_file=phpstan-preload.php ../../phpstan analyse -c app/phpstan.neon
include:
- php-version: 8.0
ini-values: memory_limit=256M
Expand Down
1 change: 1 addition & 0 deletions e2e/restricted-php-ini/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
13 changes: 13 additions & 0 deletions e2e/restricted-php-ini/app/A.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class A
{
public function foo(): void
{
}

public function bar(): void
{
var_dump($x);
}
}
13 changes: 13 additions & 0 deletions e2e/restricted-php-ini/app/B.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class B extends X
{
public function foo(): void
{
}

public function bar(): void
{
var_dump($x);
}
}
15 changes: 15 additions & 0 deletions e2e/restricted-php-ini/app/C.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

class C extends A
{
use T;

public function foo(): void
{
}

public function bar(): void
{
var_dump($x);
}
}
9 changes: 9 additions & 0 deletions e2e/restricted-php-ini/app/T.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

trait T
{
public function ff(): void
{
var_dump($x);
}
}
13 changes: 13 additions & 0 deletions e2e/restricted-php-ini/app/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
parameters:
level: 9
paths:
- ./
parallel:
jobSize: 2
maximumNumberOfProcesses: 4
minimumNumberOfJobsPerProcess: 2
ignoreErrors:
-
message: '~^Undefined variable: \$x$~'
path: '*'
count: 4
7 changes: 7 additions & 0 deletions e2e/restricted-php-ini/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"autoload": {
"files": [
"preload.php"
]
}
}
18 changes: 18 additions & 0 deletions e2e/restricted-php-ini/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions e2e/restricted-php-ini/phpstan-preload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

set_error_handler(
function (int $severity, string $msg, string $file, int $line): bool {
if ((error_reporting() & ~4437) === 0) {
return false;
}

throw new \ErrorException($msg, 0, $severity, $file, $line);
},
\E_ALL
);

eval('class XB {}');
3 changes: 3 additions & 0 deletions e2e/restricted-php-ini/preload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

eval('class X extends XB {}');