mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-09 10:32:50 +01:00
add new rule
This commit is contained in:
@@ -154,7 +154,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname');
|
||||
|
||||
foreach($filesarray as $key => $file)
|
||||
foreach ($filesarray as $key => $file)
|
||||
{
|
||||
if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) continue;
|
||||
if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) continue;
|
||||
@@ -170,7 +170,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
@@ -183,7 +183,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
if ($val[1] != '\'"' && $val[1] != '\'\'')
|
||||
{
|
||||
@@ -201,7 +201,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/(=|sql.+)\s*\'"\s*\.\s*\$this->(....)/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
if ($val[2] != 'db->' && $val[2] != 'esca')
|
||||
{
|
||||
@@ -220,7 +220,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/(..............)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(')
|
||||
{
|
||||
@@ -236,7 +236,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
@@ -249,7 +249,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/<br \/>/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
if ($file['name'] != 'functions.lib.php')
|
||||
{
|
||||
@@ -265,7 +265,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$matches=array();
|
||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||
preg_match_all('/@var\s+array\(/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
foreach ($matches as $key => $val)
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user