Skip to content

[Bug] the documented usage of flock triggers warnings in PHP 8.5 #4581

@stof

Description

@stof

Affected page

https://www.php.net/manual/en/function.flock.php#refsect1-function.flock-examples

Issue description

https://wiki.php.net/rfc/marking_return_value_as_important updated flock to mark its return value as NoDiscard. However, the documented usage of the function is precisely discarding the return value of flock($fp, LOCK_UN) when releasing the lock

Steps to reproduce

  1. Go to https://www.php.net/manual/en/function.flock.php#refsect1-function.flock-examples
  2. Copy the code of the first example
  3. Execute that code with PHP 8.5-dev

Suggested fix

The documented usage of the function should correspond to a usage that does not trigger warnings (or the warning should be removed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDocumentation contains incorrect information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions