Issues (279)

Security Analysis    no request data  

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.

classes/Kohana/Jam/Event.php (2 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 defined('SYSPATH') OR die('No direct script access.');
2
/**
3
 * Jam Event acts as a manager for all events bound to a model
4
 *
5
 * The standard events are documented in the guide. Binding and
6
 * triggering custom events is entirely possible.
7
 *
8
 * @package    Jam
9
 * @category   Events
10
 * @author     Ivan Kerin
11
 * @copyright  (c) 2011-2012 Despark Ltd.
12
 * @license    http://www.opensource.org/licenses/isc-license.txt
13
 */
14
abstract class Kohana_Jam_Event {
15
16
	const ATTRIBUTE_PRIORITY = 20;
17
	const BEHAVIOR_PRIORITY = 10;
18
19
	protected $serial = 0;
20
21
	/**
22
	 * @var  array  The current model
23
	 */
24
	protected $_model = NULL;
25
26
	/**
27
	 * @var  array  Bound events
28
	 */
29
	protected $_events = array();
30
31
	/**
32
	 * Constructor.
33
	 *
34
	 * @param  string  $model
35
	 */
36 163
	public function __construct($model)
37
	{
38 163
		$this->_model = $model;
0 ignored issues
show
Documentation Bug introduced by
It seems like $model of type string is incompatible with the declared type array of property $_model.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39 163
	}
40
41
	/**
42
	 * Binds an event.
43
	 *
44
	 * @param   string    $event
45
	 * @param   callable  $callback
46
	 * @return  Jam_Event
47
	 */
48 155
	public function bind($event, $callback, $priority = 0)
49
	{
50 155
		if ( ! isset($this->_events[$event]))
51
		{
52 148
			$this->_events[$event] = new SplPriorityQueue();
53
		}
54
55 155
		$this->_events[$event]->insert($callback, $priority*100000 + $this->serial--);
56
57 155
		return $this;
58
	}
59
60 155
	public function discover_events($from, $priority = 0)
61
	{
62 155
		foreach (get_class_methods($from) as $method)
63
		{
64 155
			if (($ns = substr($method, 0, 5)) === 'model'
65 155
			OR  ($ns = substr($method, 0, 4)) === 'meta'
66 155
			OR  ($ns = substr($method, 0, 7)) === 'builder')
67
			{
68 155
				$this->bind(strtolower($ns.'.'.substr($method, strlen($ns) + 1)), array($from, $method), $priority);
69
			}
70
		}
71 155
	}
72
73
	/**
74
	 * Triggers an event.
75
	 *
76
	 * @param   string  $event
77
	 * @param   mixed   $sender
78
	 * @param   mixed   $params...
0 ignored issues
show
There is no parameter named $params.... Did you maybe mean $params?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
79
	 * @return  mixed
80
	 */
81 530
	public function trigger($event, $sender, $params = array())
82
	{
83 530
		if ( ! empty($this->_events[$event]))
84
		{
85 65
			$data = new Jam_Event_Data(array(
86 65
				'event'  => $event,
87 65
				'sender' => $sender,
88 65
				'args'   => $params,
89
			));
90
91
			// Create the params to be passed to the callback
92
			// Sender, Params and Event, then params passed from the trigger
93 65
			array_unshift($params, $data);
94 65
			array_unshift($params, $sender);
95
96 65
			$queue = clone $this->_events[$event];
97
98 65
			foreach ($queue as $callback)
99
			{
100 65
				call_user_func_array($callback, $params);
101
102 55
				if ($data->stop)
103
				{
104 55
					break;
105
				}
106
			}
107
108 55
			return $data->return;
109
		}
110
111 529
		return NULL;
112
	}
113
114
	/**
115
	 * Trigger a callback, if there are no callbacks found, throws an exception
116
	 *
117
	 * @param  string $type   'model', 'builder' or 'meta'
118
	 * @param  mixed  $sender Jam_Model, Jam_Builder or Jam_Meta
119
	 * @param  string $method
120
	 * @param  array  $params passed to the method
121
	 * @return mixed          returns the response from the callback
122
	 * @throws Jam_Exception_Methodmissing If no method is found
123
	 */
124 53
	public function trigger_callback($type, $sender, $method, $params)
125
	{
126 53
		$event = strtolower("{$type}.call_{$method}");
127
128 53
		if (empty($this->_events[$event]))
129
			throw new Jam_Exception_Methodmissing($sender, $method, $params);
130
131 53
		return $this->trigger($event, $sender, $params);
132
	}
133
}
134