Issues (1752)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

class/dict.test.php (6 issues)

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
/**
3
 * Test - Dict class
4
 *
5
 * @package		fwolflib
6
 * @subpackage	class.test
7
 * @copyright	Copyright 2011, Fwolf
8
 * @author      Fwolf <[email protected]>
9
 * @since		2011-07-15
10
 */
11
12
13
// Define like this, so test can run both under eclipse and web alone.
14
// {{{
15
if (! defined('SIMPLE_TEST')) {
16
	define('SIMPLE_TEST', 'simpletest/');
17
	require_once(SIMPLE_TEST . 'autorun.php');
18
}
19
// Then set output encoding
20
//header('Content-Type: text/html; charset=utf-8');
21
// }}}
22
23
// Require library define file which need test
24
require_once(dirname(__FILE__) . '/fwolflib.php');
25
require_once(FWOLFLIB . 'class/adodb.php');
26
require_once(FWOLFLIB . 'class/dict.php');
27
require_once(FWOLFLIB . 'func/ecl.php');
28
require_once(FWOLFLIB . 'func/request.php');
29
30
31
class TestDict extends UnitTestCase {
32
33
	/**
34
	 * Db object
35
	 * @var	object
36
	 */
37
	protected $oDb = null;
38
39
	/**
40
	 * Dict object
41
	 * @var	object
42
	 */
43
	protected $oDict = null;
44
45
46
	/**
47
	 * Constructor
48
	 */
49
	public function __construct () {
50
		$this->oDict = new DictTest();
51
	} // end of func __construct
52
53
54
    function TestDictSet () {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
55
		//var_dump($this->oDict->aData);
56
		$this->assertEqual(3, count($this->oDict->aData));
57
58
		//Ecl($this->oDict->LogGet(1));
59
    } // end of func TestDictSet
60
61
62
    function TestDictGet () {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
63
		$this->assertEqual('a', $this->oDict->Get(123));
64
		$this->assertEqual(2, $this->oDict->Get('bac'));
65
		$this->assertEqual(array(123 => 'a', 321 => 'c')
66
			, $this->oDict->Get(array(123, 321)));
67
68
		$this->assertEqual(array('bac'
69
				=> array('code' => 'bac', 'title' => 2))
70
			, $this->oDict->GetList('!is_numeric("{code}")'));
71
		$this->assertEqual(array(123 => array('code' => 123, 'title' => 'a')
72
				, 321 => array('code' => 321, 'title' => 'c'))
73
			, $this->oDict->GetList('"2" == substr("{code}", 1, 1)'));
74
75
		// GetList with assign cols
76
		$this->assertEqual(array(321 => 'c')
77
			, $this->oDict->GetList('"c" == "{title}"', 'title'));
78
	} // end of func TestDictGet
79
80
81
/*
82
	function TestDictGetSql () {
83
		$ar_db = array(
84
			'type'	=> 'mysqli',
85
			'host'	=> 'localhost',
86
			'user'	=> 't-2008-zbb',
87
			'pass'	=> '',
88
			'name'	=> 't-2008-zbb',
89
			'lang'	=> 'utf-8',
90
		);
91
		$this->oDb = new Adodb($ar_db);
92
		$this->oDb->Connect();
93
		Ecl($this->oDict->GetSql($this->oDb));
94
	} // end of func TestDictGetSql
95
*/
96
97
98
} // end of class TestDict
99
100
101
class DictTest extends Dict {
0 ignored issues
show
Deprecated Code introduced by
The class Dict has been deprecated with message: Use Fwlib\Db\CodeDictionary

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
102
	public function Init () {
103
		parent::Init();
104
105
		$this->Set(array(
106
			array(123,	'a'),
107
			array('bac',	2),
108
		))->Set(array(321,	'c'));
109
110
		return $this;
111
	} // end of func Init
112
113
114
	public function SetStruct () {
115
		parent::SetStruct();
116
117
		$this->SetCfg('dict-cols-pk', 'code');
0 ignored issues
show
'dict-cols-pk' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
118
	} // end of func SetStruct
119
120
121
} // end of class DictTest
122
123
124
// Change output charset in this way.
125
// {{{
126
$s_url = GetSelfUrl(false);
0 ignored issues
show
Deprecated Code introduced by
The function GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
127
$s_url = substr($s_url, strrpos($s_url, '/') + 1);
128
if ('dict.test.php' == $s_url) {
129
	$test = new TestDict();
130
	$test->run(new HtmlReporter('utf-8'));
131
}
132
// }}}
133
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
134