Skip to content

Commit 291d8de

Browse files
committed
added date as a safe function
1 parent 7026ace commit 291d8de

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

generator/src/DocPage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public function detectFalsyFunction(): bool
112112
if (preg_match('/&gd\.return\.identifier;/m', $file)) {
113113
return true;
114114
}
115+
//used for date
116+
if (preg_match('/If a non-numeric value is used for
117+
\<parameter\>timestamp\<\/parameter\>, &false; is returned/m', $file)) {
118+
return true;
119+
}
115120

116121
//used to detect imagecreatefromstring
117122
if (preg_match('/If the arguments are invalid, the function returns &false;/m', $file)) {

generator/tests/DocPageTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function testDetectFalsyFunction()
1818
$fsockopen = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/network/functions/fsockopen.xml');
1919
$arrayReplace = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/array/functions/array-replace.xml');
2020
$mktime = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/functions/mktime.xml');
21+
$date = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/functions/date.xml');
2122

2223
$this->assertTrue($pregMatch->detectFalsyFunction());
2324
$this->assertFalse($implode->detectFalsyFunction());
@@ -29,6 +30,7 @@ public function testDetectFalsyFunction()
2930
$this->assertTrue($fsockopen->detectFalsyFunction());
3031
$this->assertFalse($arrayReplace->detectFalsyFunction());
3132
$this->assertTrue($mktime->detectFalsyFunction());
33+
$this->assertTrue($date->detectFalsyFunction());
3234
}
3335

3436
public function testDetectNullsyFunction()

0 commit comments

Comments
 (0)