From 291d8de94e00bb5108843acd73b89bcdcc9ae0c6 Mon Sep 17 00:00:00 2001 From: Kharhamel Date: Thu, 8 Oct 2020 11:05:46 +0200 Subject: [PATCH] added date as a safe function --- generator/src/DocPage.php | 5 +++++ generator/tests/DocPageTest.php | 2 ++ 2 files changed, 7 insertions(+) diff --git a/generator/src/DocPage.php b/generator/src/DocPage.php index 27dd77a6..fbb4b7be 100644 --- a/generator/src/DocPage.php +++ b/generator/src/DocPage.php @@ -112,6 +112,11 @@ public function detectFalsyFunction(): bool if (preg_match('/&gd\.return\.identifier;/m', $file)) { return true; } + //used for date + if (preg_match('/If a non-numeric value is used for + \timestamp\<\/parameter\>, &false; is returned/m', $file)) { + return true; + } //used to detect imagecreatefromstring if (preg_match('/If the arguments are invalid, the function returns &false;/m', $file)) { diff --git a/generator/tests/DocPageTest.php b/generator/tests/DocPageTest.php index 0b8ed280..5bd9ac0a 100644 --- a/generator/tests/DocPageTest.php +++ b/generator/tests/DocPageTest.php @@ -18,6 +18,7 @@ public function testDetectFalsyFunction() $fsockopen = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/network/functions/fsockopen.xml'); $arrayReplace = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/array/functions/array-replace.xml'); $mktime = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/functions/mktime.xml'); + $date = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/functions/date.xml'); $this->assertTrue($pregMatch->detectFalsyFunction()); $this->assertFalse($implode->detectFalsyFunction()); @@ -29,6 +30,7 @@ public function testDetectFalsyFunction() $this->assertTrue($fsockopen->detectFalsyFunction()); $this->assertFalse($arrayReplace->detectFalsyFunction()); $this->assertTrue($mktime->detectFalsyFunction()); + $this->assertTrue($date->detectFalsyFunction()); } public function testDetectNullsyFunction()