PHPSandbox

WhitelistVisitor extends NodeVisitorAbstract
in package

Whitelister class for PHP Sandboxes.

This class takes parsed AST code and checks it against the passed PHPSandbox instance configuration to autmatically whitelist trusted code functions, classes, etc. if the appropriate settings are configured.

Tags
namespace

PHPSandbox

author

Elijah Horton [email protected]

version
3.0

Table of Contents

$sandbox  : PHPSandbox
The PHPSandbox instance to check against
__construct()  : mixed
WhitelistVisitor class constructor
leaveNode()  : bool|null
Examine the current PhpParser_Node node against the PHPSandbox configuration for whitelisting trusted code

Properties

Methods

__construct()

WhitelistVisitor class constructor

public __construct(PHPSandbox $sandbox) : mixed

This constructor takes a passed PHPSandbox instance to check against for whitelisting trusted code.

Parameters
$sandbox : PHPSandbox

The PHPSandbox instance to check against

Return values
mixed

leaveNode()

Examine the current PhpParser_Node node against the PHPSandbox configuration for whitelisting trusted code

public leaveNode(Node $node) : bool|null
Parameters
$node : Node

The trusted $node to examine

Tags
throws
Throwable
Return values
bool|null

Return false if node must be removed, or null if no changes to the node are made

Search results