php8.5
Home/ Manual/ taint / functions/ is_tainted

is_tainted

PHP function Edit on GitHub ✎

(PECL taint >=0.1.0)

Check whether a string is tainted

Description

is_tainted(string $string): bool

Checks whether the given value carries the taint mark. Only strings can ever be tainted; any other type returns false.

Parameters

string

The value to check.

Return Values

Returns true if the value is a tainted string, false otherwise. Always returns false when taint.enable is off.

Examples

is_tainted() example

php
<?php
$name = $_GET['name'] ?? 'world';
var_dump(is_tainted($name));
?>

The above example will output something similar to:

output
bool(true)

See Also

Source: reference/taint/functions/is-tainted.xml · from the official PHP manual (php/doc-en)