Issues (1066)

Security Analysis    7 potential vulnerabilities

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

  Cross-Site Scripting (1)
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 (3)
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 (3)
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/Tests/_archive/test_ajax.php (7 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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 54 and the first side effect is on line 3.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
//error_reporting(E_ALL);
3
set_include_path(
4
	get_include_path().PATH_SEPARATOR
5
	.'zend-framework/'
6
);
7
8
require_once('../PhpQuery/PhpQuery.php');
9
PhpQuery::$debug = true;
0 ignored issues
show
The property debug cannot be accessed from this context as it is declared private in class PhpQuery.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Documentation Bug introduced by
The property $debug was declared of type integer, but true is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
10
PhpQuery::$ajaxAllowedHosts[] = 'wikipedia.org';
11
PhpQuery::$ajaxAllowedHosts[] = 'google.com';
12
PhpQuery::$ajaxAllowedHosts[] = 'code.google.com';
13
PhpQuery::$ajaxAllowedHosts[] = 'www.google.com';
14
15
//$pq = PhpQuery::ajax(array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
16
//	'url' => 'http://wikipedia.org/',
17
//	'success' => 'v87shs79d8fhs9d'
18
//));
19
//function v87shs79d8fhs9d($html) {
20
//	$title = PhpQuery::newDocument($html)->find('title');
21
//	$testName = 'Simple AJAX';
22
//	if ( strpos(strtolower($title->html()), 'wikipedia') !== false )
23
//		print "Test '$testName' PASSED :)";
24
//	else {
25
//		print "Test '$testName' <strong>FAILED</strong> !!! ";
26
//		print "<pre>";
27
//		print_r($title->whois());
28
//		print "</pre>\n";
29
//	}
30
//	print "\n";
31
//}
32
33
34
$testName = 'Load';
35
$test = PhpQuery::newDocumentFile('test.html')
0 ignored issues
show
The method newDocumentFile() does not seem to exist on object<PhpQuery>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
	->find('div:first')
37
	->load('http://wikipedia.org/ div[lang]');
38
if (pq('div[lang]')->size())
39
	print "Test '$testName' PASSED :)";
40
else {
41
	print "Test '$testName' <strong>FAILED</strong> !!! ";
42
	print "<pre>";
43
	print "</pre>\n";
44
}
45
print "\n";
46
47
48
// http://code.google.com/p/phpquery/issues/detail?id=130
49
$pq = PhpQuery::ajax(array(
0 ignored issues
show
The method ajax() does not seem to exist on object<PhpQuery>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
	'url' => 'http://'.$_SERVER['SERVER_NAME'].preg_replace('@/[^/]+$@', '/test_ajax_data_1', $_SERVER['REQUEST_URI']),
51
	'success' => 'a789fhasdui3124',
52
	'error' => 'jhdbg786213u8dsfg7y'
53
));
54
function a789fhasdui3124($html) {
55
	$testName = 'AJAX request text node';
56
	if ( $html == 'hello world' )
57
		print "Test '$testName' PASSED :)";
58
	else {
59
		print "Test '$testName' <strong>FAILED</strong> !!! ";
60
	}
61
	print "\n";
62
}
63
64
function jhdbg786213u8dsfg7y() {
65
	$testName = 'AJAX request text node';
66
	print "Test '$testName' <strong>FAILED</strong> !!! ";
67
}
68
69
70
//$testName = 'gdata plugin';
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
71
//PhpQuery::extend('gdata');
72
//$xhr = PhpQuery::$plugins->gdata('[email protected]', 'XXX');
73
//$url = 'http://code.google.com/p/phpquery/w/edit/Callbacks';
74
//PhpQuery::ajax(array('url' => $url, 'success' => 'ksjsdgh892jh23'), $xhr);
75
//function ksjsdgh892jh23($html) {
76
//	print $html;
77
//	print pq($html)->find('script')->remove()->end();
78
//	if (pq('div[lang]')->size())
79
//		print "Test '$testName' PASSED :)";
80
//	else {
81
//		print "Test '$testName' <strong>FAILED</strong> !!! ";
82
//		print "<pre>";
83
//		print "</pre>\n";
84
//	}
85
//	print "\n";
86
//}