I am using PHPSandbox and have a specific requirement regarding function and method calls within the sandbox. Specifically, I would like to allow certain methods of a class to execute, even if they internally use functions that I want to restrict from being called directly by the user.
For example, I want to permit the method Biz::find() to be called, which internally uses various mysqli_* functions. However, I do not want to allow any direct calls to mysqli_* functions within the sandbox. Essentially, Biz::find() should be allowed, but any direct invocation of mysqli_connect(), mysqli_query(), etc., should be disallowed.
Here are some micro code examples to illustrate the requirement:
Desired Behavior:
class Biz {
public static function find() {
// Internally uses mysqli_* functions
$mysqli = mysqli_connect("localhost", "user", "password", "database");
// Other mysqli_* operations...
}
}
// Allowed
Biz::find();
How can I configure PHPSandbox to allow Biz::find() but disallow direct calls to mysqli_* functions? I am looking for a way to specify this within the sandbox environment.
Hello,
I am using PHPSandbox and have a specific requirement regarding function and method calls within the sandbox. Specifically, I would like to allow certain methods of a class to execute, even if they internally use functions that I want to restrict from being called directly by the user.
For example, I want to permit the method
Biz::find()
to be called, which internally uses variousmysqli_*
functions. However, I do not want to allow any direct calls tomysqli_*
functions within the sandbox. Essentially,Biz::find()
should be allowed, but any direct invocation ofmysqli_connect()
,mysqli_query()
, etc., should be disallowed.Here are some micro code examples to illustrate the requirement:
Desired Behavior:
Undesired Behavior:
PHPSandbox Configuration:
How can I configure PHPSandbox to allow
Biz::find()
but disallow direct calls tomysqli_*
functions? I am looking for a way to specify this within the sandbox environment.Thank you for your help.