Skip to content

Bug: random_string incorrectly marked as deprecated #9845

@FedeltaMedia

Description

@FedeltaMedia

PHP Version

8.3

CodeIgniter4 Version

4.6.4

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

No response

What happened?

The random_string text helper (docs) is incorrectly marked as deprecated. Because of this, PHP Intelephense in VS Code shows the use of random_string as deprecated. Even though none of the deprecated types are used.

Image

Only the type 'basic', 'md5', and 'sha1' are deprecated because they are not cryptographically secure. The random_string function itself is not deprecated.

Code:

* @deprecated The type 'basic', 'md5', and 'sha1' are deprecated. They are not cryptographically secure.

The @deprecated tag is used to indicate which Structural Elements are deprecated and are to be removed in a future version.
https://docs.phpdoc.org/guide/references/phpdoc/tags/deprecated.html#deprecated
https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#54-deprecated

Steps to Reproduce

Add this code to a CI4 project:
$newHash = random_string('crypto', 10);

Expected Output

Not deprecated

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions