|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81566 ob_get_status return value contains non-existing constants
Submitted: 2021-10-29 17:25 UTC Modified: 2021-11-02 11:25 UTC
From: pegasus at vaultwiki dot org Assigned:
Status: Closed Package: Output Control
PHP Version: master-Git-2021-10-29 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pegasus at vaultwiki dot org
New email:
PHP Version: OS:


 [2021-10-29 17:25 UTC] pegasus at vaultwiki dot org
The PHP documentation for ob_get_status says that the returned "type" key may be one of PHP_OUTPUT_HANDLER_INTERNAL or PHP_OUTPUT_HANDLER_USER:

However, these constants have historically not been defined and are still undefined:

Since PHP 8, undefined constants are now fatal errors. This means the following code, which the documentation suggests should work, will now throw a fatal error.

So this is either a PHP bug (two missing output-control constants), or a PHP documentation bug (docs mentioning constants that do not exist).

Test script:

$status = ob_get_status();

if ($status['type'] == PHP_OUTPUT_HANDLER_INTERNAL) // fatal error
// do something

Expected result:
The condition should be evaluated without notice, warning, or fatal error; or the documentation should be updated so that it no longer suggests that these constants exist and are return values of ob_get_status.

Actual result:
Before 7.2: E_NOTICE
7.2-7.4: E_WARNING
8+: fatal


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-02 11:25 UTC]
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2021-11-02 11:25 UTC]
This is a documentation issue.  "type" is either 0 (internal
handler) or 1 (userland handler).
 [2021-11-02 12:46 UTC]
Automatic comment on behalf of cmb69
Log: Fix #81566: ob_get_status return value contains non-existing constants
 [2021-11-02 12:46 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 04:01:30 2024 UTC