mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 00:58:48 +02:00
N°2154 - fix server crash in rare cases
Under undetermined circumstances, `exec('php -v')` called the current script triggering an infinite loop crashing the server
problem reported by @molkobain
see: https://stackoverflow.com/questions/43728378/running-php-files-through-shell-exec
This commit is contained in:
@@ -32,7 +32,7 @@ class iTopConfigAstValidatorTest extends ItopTestCase
|
||||
public function testValidCode()
|
||||
{
|
||||
$oiTopConfigValidator = new iTopConfigSyntaxValidator();
|
||||
$oiTopConfigValidator->Validate("<?php \n echo 'foo'; ", false);
|
||||
$oiTopConfigValidator->Validate("<?php \n echo 'foo'; ");
|
||||
}
|
||||
|
||||
public function testThrowOnInvalidCode()
|
||||
@@ -41,10 +41,10 @@ class iTopConfigAstValidatorTest extends ItopTestCase
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
try{
|
||||
$oiTopConfigValidator->Validate("<?php \n zef;zefzef \n zdadz = azdazd \n zerfgzaezerfgzef>", false);
|
||||
$oiTopConfigValidator->Validate("<?php \n zef;zefzef \n zdadz = azdazd \n zerfgzaezerfgzef>");
|
||||
}catch (\Exception $e)
|
||||
{
|
||||
$this->assertStringStartsWith('PHP Parse error: syntax error, unexpected \'zdadz\' (T_STRING)', $e->getMessage());
|
||||
$this->assertStringStartsWith('Error in configuration: syntax error, unexpected \'zdadz\' (T_STRING)', $e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user