🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Output buffering being active is not recognized #10348

Description

@jrfnl

Bug report

When a call to ob_get_contents() is preceded within the same scope by a call to ob_start() and the value returned by ob_get_contents() is subsequently used in a function expecting string, it will still trigger a warning for passing string|false, while ob_get_contents() will only return false when output buffering is not active and by checking for the call to ob_start() it could be confirmed that output buffering is actually active and that ob_get_contents() will return a string.

Same goes for ob_get_clean() and ob_get_flush() and ob_get_length() (int|false)

Ref: https://www.php.net/manual/en/function.ob-get-contents.php

Code snippet that reproduces the problem

https://phpstan.org/r/9fab3e68-10ae-4c6b-96af-a6718762b2d6

Expected output

None

Did PHPStan help you today? Did it make you happy in any way?

Always and trying to help in return by reporting this issue ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions