GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (187)

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.

src/Jobs/PublishItemsJob.php (7 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 Symbiote\QueuedJobs\Jobs;
4
5
use Page;
6
use SilverStripe\ORM\DataObject;
7
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
8
use Symbiote\QueuedJobs\Services\QueuedJob;
9
10
/**
11
 * An example queued job
12
 *
13
 * Use this as an example of how you can write your own jobs
14
 *
15
 * @author Marcus Nyeholt <[email protected]>
16
 * @license BSD http://silverstripe.org/bsd-license/
17
 */
18
class PublishItemsJob extends AbstractQueuedJob implements QueuedJob
19
{
20
    /**
21
     * @param DataObject $rootNodeID
22
     */
23
    public function __construct($rootNodeID = null)
24
    {
25
        // this value is automatically persisted between processing requests for
26
        // this job
27
        if ($rootNodeID) {
28
            $this->rootID = $rootNodeID;
0 ignored issues
show
The property rootID does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. 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...
29
        }
30
    }
31
32
    protected function getRoot()
33
    {
34
        return DataObject::get_by_id(Page::class, $this->rootID);
0 ignored issues
show
The property rootID does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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
     * Defines the title of the job
39
     *
40
     * @return string
41
     */
42
    public function getTitle()
43
    {
44
        $title = 'Unknown';
45
46
        if ($root = $this->getRoot()) {
47
            $title = $root->Title;
48
        }
49
50
        return _t(
51
            __CLASS__ . '.Title',
52
            "Publish items beneath {title}",
53
            ['title' => $title]
54
        );
55
    }
56
57
    /**
58
     * Indicate to the system which queue we think we should be in based
59
     * on how many objects we're going to touch on while processing.
60
     *
61
     * We want to make sure we also set how many steps we think we might need to take to
62
     * process everything - note that this does not need to be 100% accurate, but it's nice
63
     * to give a reasonable approximation
64
     *
65
     * @return int
66
     */
67
    public function getJobType()
68
    {
69
        $this->totalSteps = 'Lots';
0 ignored issues
show
Documentation Bug introduced by
The property $totalSteps was declared of type integer, but 'Lots' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
70
        return QueuedJob::QUEUED;
71
    }
72
73
    /**
74
     * This is called immediately before a job begins - it gives you a chance
75
     * to initialise job data and make sure everything's good to go
76
     *
77
     * What we're doing in our case is to queue up the list of items we know we need to
78
     * process still (it's not everything - just the ones we know at the moment)
79
     *
80
     * When we go through, we'll constantly add and remove from this queue, meaning
81
     * we never overload it with content
82
     */
83
    public function setup()
84
    {
85
        if (!$this->getRoot()) {
86
            // we're missing for some reason!
87
            $this->isComplete = true;
88
            $this->remainingChildren = array();
0 ignored issues
show
The property remainingChildren does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. 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...
89
            return;
90
        }
91
        $remainingChildren = array();
92
        $remainingChildren[] = $this->getRoot()->ID;
93
        $this->remainingChildren = $remainingChildren;
0 ignored issues
show
The property remainingChildren does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. 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...
94
95
        // we reset this to 1; this is because we only know for sure about 1 item remaining
96
        // as time goes by, this will increase as we discover more items that need processing
97
        $this->totalSteps = 1;
98
    }
99
100
    /**
101
     * Lets process a single node, and publish it if necessary
102
     */
103
    public function process()
104
    {
105
        $remainingChildren = $this->remainingChildren;
0 ignored issues
show
The property remainingChildren does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. 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...
106
107
        // if there's no more, we're done!
108
        if (!count($remainingChildren)) {
109
            $this->isComplete = true;
110
            return;
111
        }
112
113
        // we need to always increment! This is important, because if we don't then our container
114
        // that executes around us thinks that the job has died, and will stop it running.
115
        $this->currentStep++;
116
117
        // lets process our first item - note that we take it off the list of things left to do
118
        $ID = array_shift($remainingChildren);
119
120
        // get the page
121
        $page = DataObject::get_by_id(Page::class, $ID);
122
        if ($page) {
123
            // publish it
124
            $page->doPublish();
125
126
            // and add its children to the list to be published
127
            foreach ($page->Children() as $child) {
128
                $remainingChildren[] = $child->ID;
129
                // we increase how many steps we need to do - this means our total steps constantly rises,
130
                // but it gives users an idea of exactly how many more we know about
131
                $this->totalSteps++;
132
            }
133
            $page->destroy();
134
            unset($page);
135
        }
136
137
        // and now we store the new list of remaining children
138
        $this->remainingChildren = $remainingChildren;
0 ignored issues
show
The property remainingChildren does not exist on object<Symbiote\QueuedJobs\Jobs\PublishItemsJob>. 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...
139
140
        if (!count($remainingChildren)) {
141
            $this->isComplete = true;
142
            return;
143
        }
144
    }
145
}
146