Completed
Push — master ( da58d4...61a0f7 )
by Henry
06:34
created

Check for loose comparison of strings.

Best Practice Bug Major

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript;
3
4
use function is_file;
5
use function set_include_path;
6
7
/* bootstrap */
8
9
include_once('includes' . DIRECTORY_SEPARATOR . 'bootstrap.php');
10
11
/* header */
12
13
Header::init();
14
15
/* get instance */
16
17
$registry = Registry::getInstance();
18
19
/* redirect to install */
20
21
if ($registry->get('dbStatus') < 2 && is_file('install.php'))
22
{
23
	Header::doRedirect('install.php');
24
	exit;
25
}
26
27
/* render */
28
29
Module\Hook::trigger('renderStart');
30
if ($registry->get('renderBreak'))
31
{
32
	Header::responseCode(202);
33
	exit;
34
}
35
36
/* template */
37
38
set_include_path('templates');
39
$renderTemplate = Module\Hook::trigger('renderTemplate');
40
if ($renderTemplate)
0 ignored issues
show
Bug Best Practice introduced by
The expression $renderTemplate of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
41
{
42
	echo $renderTemplate;
43
}
44
else
45
{
46
47
	include_once($registry->get('template') . DIRECTORY_SEPARATOR . 'index.phtml');
48
}
49
Module\Hook::trigger('renderEnd');
50