This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the webmozart/console package. |
||
5 | * |
||
6 | * (c) Bernhard Schussek <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Webmozart\Console\IO; |
||
13 | |||
14 | use Webmozart\Console\Api\Formatter\Formatter; |
||
15 | use Webmozart\Console\Api\IO\Input; |
||
16 | use Webmozart\Console\Api\IO\IO; |
||
17 | use Webmozart\Console\Api\IO\Output; |
||
18 | use Webmozart\Console\Formatter\PlainFormatter; |
||
19 | use Webmozart\Console\IO\InputStream\StringInputStream; |
||
20 | use Webmozart\Console\IO\OutputStream\BufferedOutputStream; |
||
21 | |||
22 | /** |
||
23 | * An I/O that reads from and writes to a buffer. |
||
24 | * |
||
25 | * @since 1.0 |
||
26 | * |
||
27 | * @author Bernhard Schussek <[email protected]> |
||
28 | */ |
||
29 | class BufferedIO extends IO |
||
30 | { |
||
31 | /** |
||
32 | * Creates the I/O. |
||
33 | * |
||
34 | * @param string $inputData The data to return from the input. |
||
35 | * @param Formatter $formatter The formatter to use. |
||
0 ignored issues
–
show
|
|||
36 | */ |
||
37 | 158 | public function __construct($inputData = '', Formatter $formatter = null) |
|
38 | { |
||
39 | 158 | $formatter = $formatter ?: new PlainFormatter(); |
|
40 | 158 | $input = new Input(new StringInputStream($inputData)); |
|
41 | 158 | $output = new Output(new BufferedOutputStream(), $formatter); |
|
42 | 158 | $errorOutput = new Output(new BufferedOutputStream(), $formatter); |
|
43 | |||
44 | 158 | parent::__construct($input, $output, $errorOutput); |
|
45 | 158 | } |
|
46 | |||
47 | /** |
||
48 | * Sets the contents of the input buffer. |
||
49 | * |
||
50 | * @param string $data The input data. |
||
51 | */ |
||
52 | 3 | public function setInput($data) |
|
53 | { |
||
54 | 3 | $this->getInput()->getStream()->set($data); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\InputStream as the method set() does only exist in the following implementations of said interface: Webmozart\Console\IO\InputStream\StringInputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
55 | 3 | } |
|
56 | |||
57 | /** |
||
58 | * Appends data to the input buffer. |
||
59 | * |
||
60 | * @param string $data The input data to append. |
||
61 | */ |
||
62 | 1 | public function appendInput($data) |
|
63 | { |
||
64 | 1 | $this->getInput()->getStream()->append($data); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\InputStream as the method append() does only exist in the following implementations of said interface: Webmozart\Console\IO\InputStream\StringInputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
65 | 1 | } |
|
66 | |||
67 | /** |
||
68 | * Clears the input buffer. |
||
69 | */ |
||
70 | 1 | public function clearInput() |
|
71 | { |
||
72 | 1 | $this->getInput()->getStream()->clear(); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\InputStream as the method clear() does only exist in the following implementations of said interface: Webmozart\Console\IO\InputStream\StringInputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
73 | 1 | } |
|
74 | |||
75 | /** |
||
76 | * Returns the contents of the output buffer. |
||
77 | * |
||
78 | * @return string The output data. |
||
79 | */ |
||
80 | 93 | public function fetchOutput() |
|
81 | { |
||
82 | 93 | return $this->getOutput()->getStream()->fetch(); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\OutputStream as the method fetch() does only exist in the following implementations of said interface: Webmozart\Console\IO\Out...am\BufferedOutputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Clears the output buffer. |
||
87 | */ |
||
88 | 1 | public function clearOutput() |
|
89 | { |
||
90 | 1 | $this->getOutput()->getStream()->clear(); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\OutputStream as the method clear() does only exist in the following implementations of said interface: Webmozart\Console\IO\Out...am\BufferedOutputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
91 | 1 | } |
|
92 | |||
93 | /** |
||
94 | * Returns the contents of the error output buffer. |
||
95 | * |
||
96 | * @return string The data of the error output. |
||
97 | */ |
||
98 | 6 | public function fetchErrors() |
|
99 | { |
||
100 | 6 | return $this->getErrorOutput()->getStream()->fetch(); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\OutputStream as the method fetch() does only exist in the following implementations of said interface: Webmozart\Console\IO\Out...am\BufferedOutputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Clears the error output buffer. |
||
105 | */ |
||
106 | 1 | public function clearErrors() |
|
107 | { |
||
108 | 1 | $this->getErrorOutput()->getStream()->clear(); |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Webmozart\Console\Api\IO\OutputStream as the method clear() does only exist in the following implementations of said interface: Webmozart\Console\IO\Out...am\BufferedOutputStream .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
109 | 1 | } |
|
110 | } |
||
111 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.