Doc #81566 [Ver->Csd]: ob_get_status return value contains non-existing constants
Edit report at https://bugs.php.net/bug.php?id=81566&edit=1
ID: 81566
Updated by: git@php.net
Reported by: pegasus at vaultwiki dot org
Summary: ob_get_status return value contains non-existing
constants
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Output Control
PHP Version: master-Git-2021-10-29 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/55f70d19870c396f3bf86b6c45826da3cb7e525f
Log: Fix #81566: ob_get_status return value contains non-existing constants
Previous Comments:
------------------------------------------------------------------------
[2021-11-02 11:25:28] cmb@php.net
This is a documentation issue. "type" is either 0 (internal
handler) or 1 (userland handler).
------------------------------------------------------------------------
[2021-10-29 17:25:01] pegasus at vaultwiki dot org
Description:
------------
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:
https://www.php.net/manual/en/function.ob-get-status.php
However, these constants have historically not been defined and are still undefined:
https://github.com/php/php-src/blob/29e5e4719c253e28f521f9fbee6b1bf2ea5f7e22/main/output.c#L206
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:
---------------
ob_start();
$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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81566&edit=1
Thread (2 messages)