Bug->Doc #81566 [Opn->Ver]: ob_get_status return value contains non-existing constants

From: Date: Tue, 02 Nov 2021 11:25:28 +0000
Subject: Bug->Doc #81566 [Opn->Ver]: ob_get_status return value contains non-existing constants
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19298@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81566&edit=1 ID: 81566 Updated by: cmb@php.net Reported by: pegasus at vaultwiki dot org Summary: ob_get_status return value contains non-existing constants -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem Package: Output Control PHP Version: master-Git-2021-10-29 (Git) Block user comment: N Private report: N New Comment: This is a documentation issue. "type" is either 0 (internal handler) or 1 (userland handler). Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#19298) next »