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/QrcodeApi.php (4 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
use Wechat\Api;
5
6
/**
7
 * 微信二维码相关接口.
8
 *
9
 * @author Tian.
10
 */
11
class QrcodeApi extends BaseApi
12
{
13
    /**
14
     * 创建临时二维码 - 场景值ID(Int)
15
     *
16
     * @param  integer $scene_id       [场景值ID]
17
     * @param  integer $expire_seconds [该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒]
18
     *
19
     * @return bool|array  $res
20
     */
21
    public function create($scene_id = 0, $expire_seconds = 30)
22
    {
23 View Code Duplication
        if (!is_numeric($scene_id) || $scene_id < 0 || $scene_id > 4294967295) {
0 ignored issues
show
This code seems to be duplicated across 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...
24
            $this->setError('scene_id 必须为整数,且 不能 小于 0 大于 4294967295');
25
26
            return false;
27
        }
28
29
        if (!is_numeric($expire_seconds) || $expire_seconds < 0 || $expire_seconds > 2592000) {
30
            $this->setError('expire_seconds 必须为整数,且 不能 小于 0 大于 2592000');
31
32
            return false;
33
        }
34
35
        $queryStr = [
36
            'expire_seconds' => $expire_seconds,
37
            'action_name'    => 'QR_SCENE',
38
            'action_info'    => [
39
                'scene' => [
40
                    'scene_id' => $scene_id,
41
                ],
42
            ],
43
        ];
44
45
        $res = $this->_post('create', $queryStr);
46
47
        return $res;
48
    }
49
50
    /**
51
     * 创建永久二维码 - 场景值ID(Int)
52
     *
53
     * @param  integer $scene_id [场景值ID]
54
     *
55
     * @return bool|array  $res
56
     */
57
    public function createLimitInt($scene_id = 0)
58
    {
59 View Code Duplication
        if (!is_numeric($scene_id) || $scene_id < 0 || $scene_id > 4294967295) {
0 ignored issues
show
This code seems to be duplicated across 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...
60
            $this->setError('scene_id 必须为整数,且 不能 小于 0 大于 4294967295');
61
62
            return false;
63
        }
64
65
        $queryStr = [
66
            'action_name' => 'QR_LIMIT_SCENE',
67
            'action_info' => [
68
                'scene' => [
69
                    'scene_id' => $scene_id,
70
                ],
71
            ],
72
        ];
73
74
        $res = $this->_post('create', $queryStr);
75
76
        return $res;
77
    }
78
79
    /**
80
     * 创建永久二维码 - 场景值Str(Str)
81
     *
82
     * @param  integer $scene_id [场景值ID]
0 ignored issues
show
There is no parameter named $scene_id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

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

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

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

Loading history...
83
     *
84
     * @return bool|array  $res
85
     */
86
    public function createLimitStr($scene_str = '')
87
    {
88
        if (!is_string($scene_str) || is_numeric($scene_str)) {
89
            $this->setError('scene_str 必须为字符串');
90
91
            return false;
92
        }
93
94
        $queryStr = [
95
            'action_name' => 'QR_LIMIT_STR_SCENE',
96
            'action_info' => [
97
                'scene' => [
98
                    'scene_str' => $scene_str,
99
                ],
100
            ],
101
        ];
102
103
        $res = $this->_post('create', $queryStr);
104
105
        return $res;
106
    }
107
108
    /**
109
     * 通过ticket换取二维码
110
     *
111
     * @param  string $ticket [获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。]
112
     *
113
     * @return string        [是一张图片,可以直接展示或者下载]
114
     */
115 View Code Duplication
    public function show($ticket = '')
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...
116
    {
117
        Api::setApiUrl('https://mp.weixin.qq.com/');
118
119
        $this->module = 'showqrcode';
120
121
        $queryStr = ['ticket' => $ticket];
122
123
        $res = $this->_get('', $queryStr);
124
125
        if (!$res) {
126
            $this->setError('二维码获取失败');
127
128
            return false;
129
        }
130
131
        return $res;
132
    }
133
}
134