Issues (3099)

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.

Form/DataTransformer/TagsTransformer.php (1 issue)

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 Kunstmaan\TaggingBundle\Form\DataTransformer;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Kunstmaan\TaggingBundle\Entity\TagManager;
7
use Symfony\Component\Form\DataTransformerInterface;
8
9
class TagsTransformer implements DataTransformerInterface
10
{
11
    protected $tagManager;
12
13
    public function __construct(TagManager $tagManager)
14
    {
15
        $this->tagManager = $tagManager;
16
    }
17
18
    /**
19
     * Transforms a value from the original representation to a transformed representation.
20
     *
21
     * This method is called on two occasions inside a form field:
22
     *
23
     * 1. When the form field is initialized with the data attached from the datasource (object or array).
24
     * 2. When data from a request is bound using {@link Field::bind()} to transform the new input data
25
     *    back into the renderable format. For example if you have a date field and bind '2009-10-10' onto
26
     *    it you might accept this value because its easily parsed, but the transformer still writes back
27
     *    "2009/10/10" onto the form field (for further displaying or other purposes).
28
     *
29
     * This method must be able to deal with empty values. Usually this will
30
     * be NULL, but depending on your implementation other empty values are
31
     * possible as well (such as empty strings). The reasoning behind this is
32
     * that value transformers must be chainable. If the transform() method
33
     * of the first value transformer outputs NULL, the second value transformer
34
     * must be able to process that value.
35
     *
36
     * By convention, transform() should return an empty string if NULL is
37
     * passed.
38
     *
39
     * @param mixed $value The value in the original representation
40
     *
41
     * @return mixed The value in the transformed representation
42
     *
43
     * @throws UnexpectedTypeException       when the argument is not a string
44
     * @throws TransformationFailedException when the transformation fails
45
     */
46
    public function transform($value)
47
    {
48
        $result = array();
49
50
        if (!($value instanceof ArrayCollection)) {
51
            return $result;
52
        }
53
54
        foreach ($value as $tag) {
55
            $result[] = $tag->getId();
56
        }
57
58
        return $result;
59
    }
60
61
    /**
62
     * Transforms a value from the transformed representation to its originalœ
63
     * representation.
64
     *
65
     * This method is called when {@link Field::bind()} is called to transform the requests tainted data
66
     * into an acceptable format for your data processing/model layer.
67
     *Å“
68
     * This method must be able to deal with empty values. Usually this will
69
     * be an empty string, but depending on your implementation other empty
70
     * values are possible as well (such as empty strings). The reasoning behind
71
     * this is that value transformers must be chainable. If the
72
     * reverseTransform() method of the first value transformer outputs an
73
     * empty string, the second value transformer must be able to process that
74
     * value.
75
     *
76
     * By convention, reverseTransform() should return NULL if an empty string
77
     * is passed.
78
     *
79
     * @param mixed $value The value in the transformed representation
80
     *
81
     * @return mixed The value in the original representation
0 ignored issues
show
Consider making the return type a bit more specific; maybe use ArrayCollection.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
82
     *
83
     * @throws UnexpectedTypeException       when the argument is not of the expected type
84
     * @throws TransformationFailedException when the transformation fails
85
     */
86
    public function reverseTransform($value)
87
    {
88
        $result = new ArrayCollection();
89
        $manager = $this->tagManager;
90
91
        foreach ($value as $tagId) {
92
            $tag = $manager->findById((int) $tagId);
93
            $result->add($tag);
94
        }
95
96
        return $result;
97
    }
98
}
99