Skip to content

Tests/playing gh users 2#4

Open
arianakataokatesting wants to merge 3 commits into
mainfrom
tests/playing-gh-users-2
Open

Tests/playing gh users 2#4
arianakataokatesting wants to merge 3 commits into
mainfrom
tests/playing-gh-users-2

Conversation

@arianakataokatesting

Copy link
Copy Markdown
Collaborator

No description provided.

Repository owner deleted a comment from ariskataoka May 7, 2021
@ariskataoka

Copy link
Copy Markdown
Owner

PHP Syntax Errors Found

Scan performed on the code at commit 6a458b1 (view code).


Error: syntax error, unexpected string (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

protected string $test;


Error: syntax error, unexpected string (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

protected string $test;


Error: syntax error, unexpected string (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

protected string $test;

@ariskataoka ariskataoka left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpcs scanning turned up:

🚫 16 errors

⚠️ 11 warnings


hashes-api-scanning skipped

Posting will continue in further review(s)


class MyProblematicClass
{
protected string $test;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: PHP syntax error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) (Generic.PHP.Syntax.PHPSyntax).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Detected usage of a non-sanitized input variable: $_POST['menu-locations'] (WordPress.Security.ValidatedSanitizedInput.InputNotSanitized).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Processing form data without nonce verification (WordPress.Security.NonceVerification.Missing).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Detected usage of a possibly undefined superglobal array index: $_POST['menu-locations']. Use isset() or empty() to check the index exists before using it (WordPress.Security.ValidatedSanitizedInput.InputNotValidated).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $menu_id (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

foreach ($_POST['menu-locations'] as $menu_id) {
echo 'ADD warning severity 10 - non-sanitized input variable';
}
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $functionsCookies (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

foreach ($_POST['menu-locations'] as $menu_id) {
echo 'ADD warning severity 10 - non-sanitized input variable';
}
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead (WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE).

}
$functionsCookies = $_COOKIE;

$functionsPost = $_POST;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Processing form data without nonce verification (WordPress.Security.NonceVerification.Missing).


$functionsPost = $_POST;

var_dump($functionsPost );

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: var_dump() found. Debug code should not normally be used in production (WordPress.PHP.DevelopmentFunctions.error_log_var_dump).


var_dump($functionsPost );

session_write_close();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: The use of PHP session function session_write_close() is prohibited (WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_write_close).

@ariskataoka ariskataoka left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous scan continued.


class MySecondProblematicClass
{
protected string $test;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: PHP syntax error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) (Generic.PHP.Syntax.PHPSyntax).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Detected usage of a non-sanitized input variable: $_POST['menu-locations'] (WordPress.Security.ValidatedSanitizedInput.InputNotSanitized).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Processing form data without nonce verification (WordPress.Security.NonceVerification.Missing).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Detected usage of a possibly undefined superglobal array index: $_POST['menu-locations']. Use isset() or empty() to check the index exists before using it (WordPress.Security.ValidatedSanitizedInput.InputNotValidated).


public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $menu_id (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

foreach ($_POST['menu-locations'] as $menu_id) {
echo 'ADD warning severity 10 - non-sanitized input variable';
}
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $functionsCookies (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

foreach ($_POST['menu-locations'] as $menu_id) {
echo 'ADD warning severity 10 - non-sanitized input variable';
}
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead (WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE).

}
$functionsCookies = $_COOKIE;

$functionsPost = $_POST;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Processing form data without nonce verification (WordPress.Security.NonceVerification.Missing).


$functionsPost = $_POST;

var_dump($functionsPost );

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: var_dump() found. Debug code should not normally be used in production (WordPress.PHP.DevelopmentFunctions.error_log_var_dump).


var_dump($functionsPost );

session_write_close();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: The use of PHP session function session_write_close() is prohibited (WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_write_close).

@ariskataoka ariskataoka left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous scan continued.

Comment thread src/Problem1Class.php

class Problem1Class
{
protected string $test;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: PHP syntax error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) (Generic.PHP.Syntax.PHPSyntax).

Comment thread src/Problem1Class.php

public function test(): string
{
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $functionsCookies (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

Comment thread src/Problem1Class.php

public function test(): string
{
$functionsCookies = $_COOKIE;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead (WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE).

Comment thread src/Problem2Class.php

public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Detected usage of a non-sanitized input variable: $_POST['menu-locations'] (WordPress.Security.ValidatedSanitizedInput.InputNotSanitized).

Comment thread src/Problem2Class.php

public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Processing form data without nonce verification (WordPress.Security.NonceVerification.Missing).

Comment thread src/Problem2Class.php

public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Detected usage of a possibly undefined superglobal array index: $_POST['menu-locations']. Use isset() or empty() to check the index exists before using it (WordPress.Security.ValidatedSanitizedInput.InputNotValidated).

Comment thread src/Problem2Class.php

public function test(): string
{
foreach ($_POST['menu-locations'] as $menu_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Unused variable $menu_id (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants