Issues (80)

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.

Fixture/MongoYamlFixture.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 Khepin\YamlFixturesBundle\Fixture;
4
5
use Doctrine\Common\Util\Inflector;
6
7
class MongoYamlFixture extends AbstractFixture
8
{
9
    /**
10
     * Creates and returns one object based on the given data and metadata
11
     *
12
     * @param $class object's class name
13
     * @param $data array of the object's fixture data
14
     * @param $metadata the class metadata for doctrine
15
     * @param $embedded true for embedded documents
16
     * @return Object
17
     */
18
    public function createObject($class, $data, $metadata, $options = array())
19
    {
20
        // options to state if a document is to be embedded or persisted on its own
21
        $embedded = isset($options['embedded']);
22
        $mapping = array_keys($metadata->fieldMappings);
23
        // Instantiate new object
24
        $object = $this->makeInstance($class, $data);
25
        unset($data['__construct']);
26
27
        foreach ($data as $field => $value) {
28
            // Add the fields defined in the fixtures file
29
            $method = Inflector::camelize('set_' . $field);
30
            // This is a standard field
31
            if (in_array($field, $mapping)) {
32
                // Dates need to be converted to DateTime objects
33
                $type = $metadata->fieldMappings[$field]['type'];
34
                if ($type == 'many') {
35
                    $method = Inflector::camelize('add_'.$field);
36
                    // EmbedMany
37
                    if (
38
                        isset($metadata->fieldMappings[$field]['embedded']) &&
39
                        $metadata->fieldMappings[$field]['embedded']) {
40
                        foreach ($value as $embedded_value) {
41
                            $embed_class = $metadata->fieldMappings[$field]['targetDocument'];
42
                            $embed_data = $embedded_value;
43
                            $embed_meta = $this->getMetaDataForClass($embed_class);
44
                            $value = $this->createObject($embed_class, $embed_data, $embed_meta, array(
45
                                'embedded' => true));
46
                            $object->$method($value);
47
                        }
48
                    //ReferenceMany
49
                    } else {
50
                        foreach ($value as $reference_object) {
51
                            $object->$method($this->loader->getReference($reference_object));
52
                        }
53
                    }
54
                } else {
55 View Code Duplication
                    if ($type == 'datetime' || $type == 'date' || $type == 'time') {
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...
56
                        $value = new \DateTime($value);
57
                    }
58
                    if ($type == 'one') {
59
                        // EmbedOne
60
                        if (
61
                            isset($metadata->fieldMappings[$field]['embedded']) &&
62
                            $metadata->fieldMappings[$field]['embedded']) {
63
                            $embed_class = $metadata->fieldMappings[$field]['targetDocument'];
64
                            $embed_data = $value;
65
                            $embed_meta = $this->getMetaDataForClass($embed_class);
66
                            $value = $this->createObject($embed_class, $embed_data, $embed_meta, array(
67
                                'embedded' => true));
68
                        // ReferenceOne
69
                        } else {
70
                            $value = $this->loader->getReference($value);
71
                        }
72
                    }
73
                    $object->$method($value);
74
                }
75
            } else {
76
                // The key is not a field's name but the name of a method to be called
77
                $object->$method($value);
78
            }
79
        }
80
81
        // Save a reference to the current object
82
        if (!$embedded) {
83
            $this->runServiceCalls($object);
84
        }
85
86
        return $object;
87
    }
88
}
89