This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once 'Intraface/XMLRPC/Contact/Server.php'; |
||
3 | |||
4 | class ContactXMLRPCTest extends PHPUnit_Framework_TestCase |
||
5 | { |
||
6 | protected $server; |
||
7 | protected $db; |
||
8 | |||
9 | function setUp() |
||
10 | { |
||
11 | $this->server = new Intraface_XMLRPC_Contact_Server; |
||
12 | $this->db = MDB2::singleton(DB_DSN); |
||
13 | } |
||
14 | |||
15 | function tearDown() |
||
16 | { |
||
17 | $this->db->exec('TRUNCATE contact'); |
||
18 | $this->db->exec('TRUNCATE address'); |
||
19 | unset($this->server); |
||
20 | unset($this->db); |
||
21 | } |
||
22 | |||
23 | function getClient() |
||
24 | { |
||
25 | require_once dirname(__FILE__) . '/../../../install/Install.php'; |
||
26 | |||
27 | if (!defined('SERVER_STATUS')) { |
||
28 | define('SERVER_STATUS', 'TEST'); |
||
29 | } |
||
30 | |||
31 | $install = new Intraface_Install; |
||
32 | $install->resetServer(); |
||
33 | $install->grantModuleAccess('administration', 'contact'); |
||
0 ignored issues
–
show
|
|||
34 | |||
35 | require_once 'XML/RPC2/Client.php'; |
||
36 | $debug = false; |
||
37 | $options = array('prefix' => 'contact.', 'debug' => $debug, 'encoding' => 'utf-8'); |
||
38 | $client = XML_RPC2_Client::create(XMLRPC_SERVER_URL.'contact', $options); |
||
39 | |||
40 | return $client; |
||
41 | } |
||
42 | |||
43 | //////////////////////////////////////////////// |
||
44 | |||
45 | function testConstruction() |
||
46 | { |
||
47 | $this->markTestIncomplete( |
||
48 | 'This test has not been implemented yet.' |
||
49 | ); |
||
50 | $this->assertTrue(is_object($this->server)); |
||
51 | } |
||
52 | |||
53 | function testEmptyCredentialsThrowsException() |
||
54 | { |
||
55 | $this->markTestIncomplete( |
||
56 | 'This test has not been implemented yet.' |
||
57 | ); |
||
58 | $credentials = array(); |
||
59 | $data = array(); |
||
60 | |||
61 | try { |
||
62 | $this->server->saveContact($credentials, $data); |
||
0 ignored issues
–
show
$credentials is of type array , but the function expects a object<Struct> .
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);
![]() |
|||
63 | $this->assertFalse(true, 'Should have thrown an exception'); |
||
64 | } catch (XML_RPC2_FaultException $e) { |
||
0 ignored issues
–
show
The class
XML_RPC2_FaultException does not exist. Did you forget a USE statement, or did you not list all dependencies?
Scrutinizer analyzes your It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis. ![]() |
|||
65 | $this->assertTrue(true); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | function testInvalidKeyThrowsException() |
||
70 | { |
||
71 | $this->markTestIncomplete( |
||
72 | 'This test has not been implemented yet.' |
||
73 | ); |
||
74 | $credentials = array('private_key' => 'privatekeyshouldbereplaced', 'session_id' => 'something'); |
||
75 | $data = array(); |
||
76 | try { |
||
77 | $this->server->saveContact($credentials, $data); |
||
0 ignored issues
–
show
$credentials is of type array<string,string,{"pr..."session_id":"string"}> , but the function expects a object<Struct> .
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);
![]() |
|||
78 | $this->assertFalse(true, 'Should have thrown an exception'); |
||
79 | } catch (XML_RPC2_FaultException $e) { |
||
0 ignored issues
–
show
The class
XML_RPC2_FaultException does not exist. Did you forget a USE statement, or did you not list all dependencies?
Scrutinizer analyzes your It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis. ![]() |
|||
80 | $this->assertTrue(true); |
||
81 | } |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @group xmlrpc |
||
86 | */ |
||
87 | function testGetContactWithDanishCharactersIsReturnedInUTF8FromTheClient() |
||
88 | { |
||
89 | $this->markTestIncomplete( |
||
90 | 'This test has not been implemented yet.' |
||
91 | ); |
||
92 | $client = $this->getClient(); |
||
93 | $credentials = array('private_key' => 'privatekeyshouldbereplaced', 'session_id' => 'something'); |
||
94 | |||
95 | $contact = new Contact(new Stub_Kernel); |
||
96 | $data = array('name' => 'Tester æøå'); |
||
97 | $res = $contact->save($data); |
||
0 ignored issues
–
show
Are you sure the assignment to
$res is correct as $contact->save($data) (which targets Contact::save() ) seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
98 | $this->assertEquals(1, $res); |
||
99 | $this->assertEquals('Tester æøå', $contact->get('name')); |
||
100 | |||
101 | $retrieved = $client->getContact($credentials, $contact->getId()); |
||
102 | |||
103 | $this->assertEquals('Tester æøå', $retrieved['name']); |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * @group xmlrpc |
||
108 | */ |
||
109 | function testSaveContactWorksWithDanishCharacters() |
||
110 | { |
||
111 | $this->markTestIncomplete( |
||
112 | 'This test has not been implemented yet.' |
||
113 | ); |
||
114 | $client = $this->getClient(); |
||
115 | $credentials = array('private_key' => 'privatekeyshouldbereplaced', 'session_id' => 'something'); |
||
116 | |||
117 | $contact = new Contact(new Stub_Kernel); |
||
118 | $data = array('name' => 'Tester'); |
||
119 | $contact->save($data); |
||
120 | |||
121 | $new_name = 'Tester æøå'; |
||
122 | $data = array('id' => $contact->getId(), 'name' => $new_name); |
||
123 | $this->assertTrue($client->saveContact($credentials, $data)); |
||
124 | |||
125 | $saved_contact = new Contact(new Stub_Kernel, $contact->getId()); |
||
126 | $this->assertEquals($new_name, $saved_contact->get('name')); |
||
127 | } |
||
128 | } |
||
129 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.