Issues (126)

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.

code/wrappers/CloudImageCached.php (11 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
 * Wraps Image_Cached. This one we have to be a little more
4
 * careful with because we don't keep a database record.
5
 *
6
 * NOTE: An Image_Cached can never actually be converted to
7
 * one of these because it's not in the db. It must be created
8
 * as this class (see CloudImage::getFormattedImage).
9
 *
10
 * @author Mark Guinn <[email protected]>
11
 * @date 01.13.2014
12
 * @package cloudassets
13
 * @subpackage wrappers
14
 */
15
class CloudImageCached extends CloudImage
16
{
17
    /** @var CloudImageCachedStore */
18
    protected $storeRecord;
19
20
    /**
21
     * Create a new cached image.
22
     * @param string $filename The filename of the image.
23
     * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.
24
     *                             Singletons don't have their defaults set.
25
     */
26
    public function __construct($filename = null, $isSingleton = false)
27
    {
28
        parent::__construct(array(), $isSingleton);
29
        $this->ID = -1;
30
        $this->Filename = $filename;
31
32
        // this covers the case where the image already exists in the cloud from a previous call
33
        if (file_exists($this->getFullPath()) && $this->containsPlaceholder()) {
0 ignored issues
show
Documentation Bug introduced by
The method containsPlaceholder does not exist on object<CloudImageCached>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
34
            $this->CloudStatus = 'Live';
0 ignored issues
show
The property CloudStatus does not exist on object<CloudImageCached>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
35
        }
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function exists()
42
    {
43
        return file_exists($this->getFullPath());
44
    }
45
46
    /**
47
     * @return String
48
     */
49
    public function getRelativePath()
50
    {
51
        return $this->getField('Filename');
52
    }
53
54
55
    /**
56
     * Prevent creating new tables for the cached record
57
     *
58
     * @return false
59
     */
60
    public function requireTable()
61
    {
62
        return false;
63
    }
64
65
66
    /**
67
     * Prevent writing the cached image to the database, but write the store record instead
68
     */
69
    public function write($showDebug = false, $forceInsert = false, $forceWrite = false, $writeComponents = false)
70
    {
71
        //throw new Exception("{$this->ClassName} can not be written back to the database.");
72
        // NOTE: we need to fail silently on writes because writing is part of the cloud upload process
73
        if ($this->storeRecord) {
74
            $this->storeRecord->write($showDebug, $forceInsert, $forceWrite, $writeComponents);
75
        }
76
    }
77
78
79
    /**
80
     * Simulates a delete
81
     */
82
    public function delete()
83
    {
84
        $this->brokenOnDelete = true;
85
        $this->onBeforeDelete();
86
        if ($this->brokenOnDelete) {
87
            user_error("$this->class has a broken onBeforeDelete() function."
88
            . " Make sure that you call parent::onBeforeDelete().", E_USER_ERROR);
89
        }
90
91
        $path = $this->getFullPath();
92
        if (file_exists($path)) {
93
            unlink($path);
94
        }
95
        if ($this->storeRecord) {
96
            $this->storeRecord->delete();
97
        }
98
99
        $this->flushCache();
100
        $this->onAfterDelete();
101
    }
102
103
104
    /**
105
     * @param CloudImageCachedStore $store
106
     * @return $this
107
     */
108
    public function setStoreRecord(CloudImageCachedStore $store)
109
    {
110
        $this->storeRecord    = $store;
111
        $this->CloudStatus   = $store->CloudStatus;
0 ignored issues
show
The property CloudStatus does not exist on object<CloudImageCached>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property CloudStatus does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
112
        $this->CloudSize     = $store->CloudSize;
0 ignored issues
show
The property CloudSize does not exist on object<CloudImageCached>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property CloudSize does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
113
        $this->CloudMetaJson = $store->CloudMetaJson;
0 ignored issues
show
The property CloudMetaJson does not exist on object<CloudImageCached>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property CloudMetaJson does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
114
        return $this;
115
    }
116
117
118
    /**
119
     * @return CloudImageCachedStore
120
     */
121
    public function getStoreRecord()
122
    {
123
        return $this->storeRecord;
124
    }
125
126
127
    /**
128
     * @param $val
129
     */
130
    public function setCloudMetaJson($val)
131
    {
132
        $this->setField('CloudMetaJson', $val);
133
        if ($this->storeRecord) {
134
            $this->storeRecord->CloudMetaJson = $val;
0 ignored issues
show
The property CloudMetaJson does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
135
            //$this->storeRecord->write();
136
        }
137
    }
138
139
140
    /**
141
     * @param $val
142
     */
143
    public function setCloudStatus($val)
144
    {
145
        $this->setField('CloudStatus', $val);
146
        if ($this->storeRecord) {
147
            $this->storeRecord->CloudStatus = $val;
0 ignored issues
show
The property CloudStatus does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
148
            //$this->storeRecord->write();
149
        }
150
    }
151
152
153
    /**
154
     * @param $val
155
     */
156
    public function setCloudSize($val)
157
    {
158
        $this->setField('CloudSize', $val);
159
        if ($this->storeRecord) {
160
            $this->storeRecord->CloudSize = $val;
0 ignored issues
show
The property CloudSize does not exist on object<CloudImageCachedStore>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
161
            //$this->storeRecord->write();
162
        }
163
    }
164
}
165