Add CLI output option to MD_JAIL

This commit is contained in:
Joshua Ramon Enslin 2020-11-11 17:25:41 +01:00 committed by Stefan Rohde-Enslin
parent 6a6f71cf10
commit 2bfc7a0dcd
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -106,6 +106,20 @@ final class MD_JAIL {
*/
public function enforce():void {
// Special instructions on CLI, so as to not disturb PHPUnit
if (PHP_SAPI === 'cli') {
if (!isset($this->memory_limit)) {
throw new MDJailSecurityOptionNotSetException("It has not been specified, which memory limit the script should hold. Set MD_JAIL->memory_limit = string.");
}
if (!isset($this->max_execution_time)) {
throw new MDJailSecurityOptionNotSetException("It has not been specified, which maximum execution time the script should hold. Set MD_JAIL->max_execution_time = integer.");
}
$this->_status = self::STATUS_SPECIFIED;
$this->__destruct();
}
$this->_apply_memory_limit();
$this->_apply_time_limit();