Issues (233)

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/API/GroupsApi.php (9 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
namespace Wechat\API;
3
4
/**
5
 * 微信用户分组相关接口.
6
 *
7
 * @author Tian.
8
 */
9
class GroupsApi extends BaseApi
10
{
11
    /**
12
     * 创建用户组.
13
     *
14
     * @param string $name 分组名 30字符以内
15
     *
16
     * @return array id 分组ID  , name 分组名.
17
     */
18
    public function create($name)
19
    {
20
        if (!is_string($name) || strlen($name) >= 30) {
21
            $this->setError('参数错误,请传入字符串或名字的长度不能大于30字符');
22
23
            return false;
24
        }
25
26
        $queryStr = [
27
            'group' => ['name' => $name],
28
        ];
29
30
        $res = $this->_post('create', $queryStr);
31
32
        return $res;
33
    }
34
35
    /**
36
     *  查询分组
37
     *
38
     * @return array 所有分组信息 如没有分组返回false.
39
     */
40
    public function get()
41
    {
42
        $queryStr = [];
43
44
        $res = $this->_get('get', $queryStr);
45
46
        return $res;
47
    }
48
49
    /**
50
     *  查询用户所在分组
51
     *
52
     * @param string $openid 用户ID
53
     *
54
     * @return int.
0 ignored issues
show
The doc-type int. could not be parsed: Unknown type name "int." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
55
     */
56 View Code Duplication
    public function getid($openid)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
    {
58
        if (!$openid) {
59
            $this->setError('参数错误,缺少Openid');
60
61
            return false;
62
        }
63
64
        $queryStr = ['openid' => $openid];
65
66
        $res = $this->_post('getid', $queryStr);
67
68
        return $res;
69
    }
70
71
    /**
72
     *  修改分组名
73
     *
74
     * @param int|string $id 分组ID,$name 分组名
75
     *
76
     * @return bool.
0 ignored issues
show
The doc-type bool. could not be parsed: Unknown type name "bool." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
77
     */
78
    public function update($id, $name)
79
    {
80
        if (!is_numeric($id) || !is_string($name) || strlen($name) >= 30) {
81
            $this->setError('参数错误,分组ID不是数字或分组名不是有效的字符串或名字的长度大于30字符');
82
83
            return false;
84
        }
85
86
        $queryStr = [
87
            'group' => ['id' => $id, 'name' => $name],
88
        ];
89
90
        $res = $this->_post('update', $queryStr);
91
92
        return $res;
93
    }
94
95
    /**
96
     *  删除指定分组
97
     *
98
     * @param int $id 分组ID
99
     *
100
     * @return bool. 注:删除成功时返回的是 '' ,删除失败时返回的是false,(包括分组ID不是数字或分组ID已经不存在)
0 ignored issues
show
The doc-type bool. could not be parsed: Unknown type name "bool." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
101
     */
102 View Code Duplication
    public function delete($id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
103
    {
104
        if (!is_numeric($id)) {
105
            $this->setError('参数错误,分组ID不是数字');
106
107
            return false;
108
        }
109
110
        $queryStr = [
111
            'group' => ['id' => $id],
112
        ];
113
114
        $res = $this->_post('delete', $queryStr);
115
116
        return $res;
117
    }
118
119
    /**
120
     *  移动用户到指定分组
121
     *
122
     * @param string $openid 用户ID,to_groupid 指定分组ID
123
     *
124
     * @return bool.
125
     */
0 ignored issues
show
The doc-type bool. could not be parsed: Unknown type name "bool." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
126
127 View Code Duplication
    public function moveUser($openid, $to_groupid)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
128
    {
129
        if (!is_numeric($to_groupid) || !is_string($openid)) {
130
            $this->setError('参数错误,用户ID格式不正确或组ID不是数字');
131
132
            return false;
133
        }
134
135
        $queryStr = ['openid' => $openid, 'to_groupid' => $to_groupid];
136
137
        $res = $this->_post('members/update', $queryStr);
138
139
        return $res;
140
    }
141
142
    /**
143
     *  批量移动用户到指定分组
144
     *
145
     * @param array $openid_list 用户ID,to_groupid 指定分组ID
146
     *
147
     * @return bool. 注:其中批量移动时,其中有一个用户的id是错的,那么其他的也不会移动,若用户已经在目标组里那么返回值也是true
0 ignored issues
show
The doc-type bool. could not be parsed: Unknown type name "bool." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
148
     */
149 View Code Duplication
    public function MoveUserlistGroup($openid_list, $to_groupid)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
150
    {
151
        if (!is_array($openid_list)) {
152
            $this->setError('参数必须为一个数组');
153
154
            return false;
155
        }
156
157
        $queryStr = ['openid_list' => $openid_list, 'to_groupid' => $to_groupid];
158
159
        $res = $this->_post('members/batchupdate', $queryStr);
160
161
        return $res;
162
    }
163
}
164