Issues (1)

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/STLSplit.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
 * This file is part of the STL package.
4
 *
5
 * (c) Grosan Flaviu Gheorghe <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace php3d\stl;
12
13
/**
14
 * Class STLSplit. Extracts separate 3D objects as STL objects.
15
 * @package php3d\stl
16
 */
17
class STLSplit {
18
    /**
19
     * @var STL
20
     */
21
    private $stl;
22
23
    /**
24
     * @return STL
25
     */
26
    public function getStl(): STL
27
    {
28
        return $this->stl;
29
    }
30
31
    /**
32
     * @param STL $stl
33
     * @return STLSplit
34
     */
35
    private function setStl(STL $stl): STLSplit
36
    {
37
        $this->stl = $stl;
38
        return $this;
39
    }
40
41
    /**
42
     * STLSplit constructor.
43
     * @param STL $stl
44
     */
45
    public function __construct(STL $stl)
46
    {
47
        $this->setStl($stl);
48
    }
49
50
    /**
51
     * Splits an STL object and returns the new 3D objects in an array of STL files.
52
     *
53
     * @return array
54
     */
55
    public function split() : array
56
    {
57
        $stlArray = $this->getStl()->toArray();
58
        $facets = $stlArray["facets"];
59
60
        $objArray = array();
61
        $vertex = $facets[0];
62
        unset($facets[0]);
63
64
        $current = 0;
65
        $objArray[$current] = array($vertex);
66
        while (count($facets) != 0) {
67
            $this->findNeighbour(
68
                $vertex,
69
                $objArray[$current],
70
                $facets
71
            );
72
            $vertex = array_pop($facets);
73
            $current++;
74
            if ($vertex) {
75
                $objArray[$current] = array($vertex);
76
            }
77
        }
78
79
        $stlObjects = array();
80
        foreach ($objArray as $key => $object) {
81
            $stlObjects[] = STL::fromArray(array(
82
                "name" => $this->getStl()->getSolidName() . $key,
83
                "facets" => $object
84
            ));
85
        }
86
87
        return $stlObjects;
88
    }
89
90
    /**
91
     * Finds the neighbouring facets of a facet.
92
     *
93
     * @param array $facet
94
     * @param array $object
95
     * @param array $facets
96
     */
97
    private function findNeighbour(array $facet, array &$object, array &$facets)
98
    {
99
        foreach ($facets as $key => $_facet) {
100
            for ($i = 0; $i < 3; $i++) {
0 ignored issues
show
$i++; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
101
                if (in_array($_facet["vertex"][$i], $facet["vertex"])) {
102
                    unset($facets[$key]);
103
                    $object[] = $_facet;
104
                    $this->findNeighbour(
105
                        $_facet,
106
                        $object,
107
                        $facets
108
                    );
109
                }
110
                continue 2;
111
            }
112
        }
113
    }
114
}
115