Issues (30)

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.

src/PhpConsole/OldVersionAdapter.php (2 issues)

Severity

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
namespace PhpConsole {
4
5
	/**
6
	 * There is adapter of PhpConsole v1.x to v3.x
7
	 * It's for users that just want to migrate from PhpConsole v1 to v3 without any code changes
8
	 *
9
	 * Usage:
10
	 *
11
	 * 1. Register PhpConsole class emulator
12
	 *
13
	 * require_once('/path/to/src/PhpConsole/__autoload.php');
14
	 * \PhpConsole\OldVersionAdapter::register();
15
	 *
16
	 * 2. Call PhpConsole v1.x methods as is:
17
	 *
18
	 * $pc = PhpConsole::getInstance();
19
	 * $pc->start($handleErrors = true, $handleExceptions = true, $sourceBasePath = null);
20
	 * PhpConsole::debug('message', 'some,tags');
21
	 * debug('message', 'some,tags');
22
	 *
23
	 * IMPORTANT: This adapter will be removed in PhpConsole > v3, so it's strongly recommended to migrate your code using original PhpConsole v3 methods
24
	 *
25
	 * @package PhpConsole
26
	 * @version 3.1
27
	 * @link http://consle.com
28
	 * @author Sergey Barbushin http://linkedin.com/in/barbushin
29
	 * @copyright © Sergey Barbushin, 2011-2013. All rights reserved.
30
	 * @license http://www.opensource.org/licenses/BSD-3-Clause "The BSD 3-Clause License"
31
	 * @codeCoverageIgnore
32
	 */
33
	class OldVersionAdapter {
34
35
		public static $callOldErrorHandler = true;
36
		public static $callOldExceptionsHandler = true;
37
38
		/** @var OldVersionAdapter|null */
39
		protected static $instance;
40
41
		private function __construct() {
42
		}
43
44
		/**
45
		 * This method must be called just to force \PhpConsole class initialization
46
		 * @param Connector|null $connector
47
		 * @param Handler|null $handler
48
		 * @throws \Exception
49
		 * @return Connector
50
		 */
51
		public static function register(Connector $connector = null, Handler $handler = null) {
0 ignored issues
show
The parameter $connector is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $handler is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
52
		}
53
54
		/**
55
		 * Start PhpConsole v1 handler
56
		 * @param bool $handleErrors
57
		 * @param bool $handleExceptions
58
		 * @param null|string $sourceBasePath
59
		 */
60
		public static function start($handleErrors = true, $handleExceptions = true, $sourceBasePath = null) {
61
			if(self::$instance) {
62
				die('PhpConsole already started');
63
			}
64
			self::$instance = new static();
65
66
			$handler = Handler::getInstance();
67
			$handler->setHandleErrors($handleErrors);
68
			$handler->setHandleExceptions($handleExceptions);
69
			$handler->setCallOldHandlers(self::$callOldErrorHandler || self::$callOldExceptionsHandler);
70
			$handler->start();
71
72
			$connector = $handler->getConnector();
73
			$connector->setSourcesBasePath($sourceBasePath);
74
		}
75
76
		public static function getInstance() {
77
			if(!self::$instance) {
78
				throw new \Exception('PhpConsole not started');
79
			}
80
			return self::$instance;
81
		}
82
83
		/**
84
		 * @return Connector
85
		 */
86
		public function getConnector() {
87
			return Connector::getInstance();
88
		}
89
90
		/**
91
		 * @return Handler
92
		 */
93
		public function getHandler() {
94
			return Handler::getInstance();
95
		}
96
97
		public function handleError($code = null, $message = null, $file = null, $line = null) {
98
			$this->getHandler()->handleError($code, $message, $file, $line, null, 1);
99
		}
100
101
		public function handleException($exception) {
102
			$this->getHandler()->handleException($exception);
103
		}
104
105
		public static function debug($message, $tags = 'debug') {
106
			Handler::getInstance()->debug($message, str_replace(',', '.', $tags), 1);
107
		}
108
	}
109
}
110
111
namespace {
112
113
	use PhpConsole\Handler;
114
	use PhpConsole\OldVersionAdapter;
115
116
	if(!class_exists('PhpConsole', false)) {
117
		class PhpConsole extends OldVersionAdapter {
118
119
		}
120
	}
121
122
	if(!function_exists('debug')) {
123
		function debug($message, $tags = 'debug') {
124
			Handler::getInstance()->debug($message, $tags, 1);
125
		}
126
	}
127
}
128