Issues (46)

Security Analysis    no request data  

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/PSolr/Request/Spellcheck.php (2 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
3
namespace PSolr\Request;
4
5
/**
6
 * @see http://wiki.apache.org/solr/SpellCheckComponent
7
 *
8
 * @method \PSolr\Response\Spellcheck sendRequest(\PSolr\Request\SolrClient $solr, $headers = null, array $options = array())
9
 */
10
class Spellcheck extends SolrRequest implements ComponentInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $handlerName = 'spell';
16
17
    /**
18
     * $var string
19
     */
20
    protected $responseClass = '\PSolr\Response\Spellcheck';
21
22
    /**
23
     * {@inheritDoc}
24
     *
25
     * Sets the query that is used in the base query.
26
     */
27
    public function preMergeParams(SolrRequest $request)
28
    {
29 View Code Duplication
        if (isset($request['q']) && !isset($this['hl.q'])) {
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...
30
            $this['spellcheck.q'] = $request['q'];
31
        }
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     *
37
     * Enables spell checking.
38
     */
39
    public function init()
40
    {
41
        $this->spellcheck();
42
    }
43
44
    /**
45
     * @param string $query
46
     *
47
     * @return \PSolr\Request\Suggest
48
     *
49
     * @see http://wiki.apache.org/solr/SpellCheckComponent#q_OR_spellcheck.q
50
     */
51
    public function setQuery($query)
52
    {
53
        return $this->set('spellcheck.q', $query);
54
    }
55
56
    /**
57
     * @param bool $spellcheck
58
     *
59
     * @return \Psolr\Component\Spellcheck
60
     *
61
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck
62
     */
63
    public function spellcheck($spellcheck = true)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
64
    {
65
        return $this->set('spellcheck', $spellcheck);
66
    }
67
68
    /**
69
     * @param bool $build
70
     *
71
     * @return \Psolr\Component\Spellcheck
72
     *
73
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.build
74
     */
75
    public function build($build = true)
76
    {
77
        return $this->set('spellcheck.build', $build);
78
    }
79
80
    /**
81
     * @param bool $reload
82
     *
83
     * @return \Psolr\Component\Spellcheck
84
     *
85
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.reload
86
     */
87
    public function reload($reload = true)
88
    {
89
        return $this->set('spellcheck.reload', $reload);
90
    }
91
92
    /**
93
     * @param string $dictionary
94
     *
95
     * @return \Psolr\Component\Spellcheck
96
     *
97
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.dictionary
98
     */
99
    public function setDictionary($dictionary)
100
    {
101
        return $this->set('spellcheck.dictionary', $dictionary);
102
    }
103
104
    /**
105
     * @param int $count
106
     *
107
     * @return \Psolr\Component\Spellcheck
108
     *
109
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.count
110
     */
111
    public function setCount($count)
112
    {
113
        return $this->set('spellcheck.dictionary', $count);
114
    }
115
116
    /**
117
     * @param int $count
118
     *
119
     * @return \Psolr\Component\Spellcheck
120
     *
121
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.alternativeTermCount
122
     */
123
    public function setAlternativeTermCount($count)
124
    {
125
        return $this->set('spellcheck.alternativeTermCount', $count);
126
    }
127
128
    /**
129
     * @param bool $onlyMorePopular
130
     *
131
     * @return \Psolr\Component\Spellcheck
132
     *
133
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.onlyMorePopular
134
     */
135
    public function onlyMorePopular($onlyMorePopular = true)
136
    {
137
        return $this->set('spellcheck.onlyMorePopular', $onlyMorePopular);
138
    }
139
140
    /**
141
     * @param int $maxResults
142
     *
143
     * @return \Psolr\Component\Spellcheck
144
     *
145
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxResultsForSuggest
146
     */
147
    public function setMaxResultsForSuggest($maxResults)
148
    {
149
        return $this->set('spellcheck.maxResultsForSuggest', $maxResults);
150
    }
151
152
    /**
153
     * @param bool $collate
154
     *
155
     * @return \Psolr\Component\Spellcheck
156
     *
157
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collate
158
     */
159
    public function collate($collate = true)
160
    {
161
        return $this->set('spellcheck.collate', $collate);
162
    }
163
164
    /**
165
     * @param int $maxCollations
166
     *
167
     * @return \Psolr\Component\Spellcheck
168
     *
169
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollations
170
     */
171
    public function setMaxCollations($maxCollations)
172
    {
173
        return $this->set('spellcheck.maxCollations', $maxCollations);
174
    }
175
176
    /**
177
     * @param int $maxTries
178
     *
179
     * @return \Psolr\Component\Spellcheck
180
     *
181
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollationTries
182
     */
183
    public function setMaxCollationTries($maxTries)
184
    {
185
        return $this->set('spellcheck.maxCollationTries', $maxTries);
186
    }
187
188
    /**
189
     * @param string $param
190
     * @param string $value
191
     *
192
     * @return \Psolr\Component\Spellcheck
193
     *
194
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateParam.XX
195
     */
196
    public function setCollateParam($param, $value)
197
    {
198
        return $this->set('spellcheck.collateParam.' . $param, $value);
199
    }
200
201
    /**
202
     * @param bool $collate
203
     *
204
     * @return \Psolr\Component\Spellcheck
205
     *
206
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateExtendedResults
207
     */
208
    public function collateExtendedResults($collate = true)
209
    {
210
        return $this->set('spellcheck.collateExtendedResults', $collate);
211
    }
212
213
    /**
214
     * @param int $maxDocs
215
     *
216
     * @return \Psolr\Component\Spellcheck
217
     *
218
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateMaxCollectDocs
219
     */
220
    public function setCollateMaxCollectDocs($maxDocs)
221
    {
222
        return $this->set('spellcheck.collateMaxCollectDocs', $maxDocs);
223
    }
224
225
    /**
226
     * @param float $accuracy
227
     *
228
     * @return \Psolr\Component\Spellcheck
229
     *
230
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.accuracy
231
     */
232
    public function setAccuracy($accuracy)
233
    {
234
        return $this->set('spellcheck.accuracy', $accuracy);
235
    }
236
237
    /**
238
     * @param string $dictionary
239
     * @param string $key
240
     * @param string $value
241
     *
242
     * @return \Psolr\Component\Spellcheck
243
     *
244
     * @see http://wiki.apache.org/solr/SpellCheckComponent#spellcheck..3CDICT_NAME.3E.key
245
     */
246
    public function setDictionaryParam($dictionary, $key, $value)
247
    {
248
        return $this->set('spellcheck.' . $dictionary . '.' . $key, $value);
249
    }
250
}
251