Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InsecureUnserializeSniff.php

function InsecureUnserializeSniff::fail

Record a violation of the standard.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:

int $position The stack position of the violation.:

Return value

void

1 call to InsecureUnserializeSniff::fail()
InsecureUnserializeSniff::processFunctionCall in vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/InsecureUnserializeSniff.php
Processes this function call.

File

vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/InsecureUnserializeSniff.php, line 96

Class

InsecureUnserializeSniff
Check that unserialize() limits classes that may be unserialized.

Namespace

DrupalPractice\Sniffs\FunctionCalls

Code

protected function fail(File $phpcsFile, int $position) {
    $phpcsFile->addError('unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.', $position, 'InsecureUnserialize');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal