Bug #81566 [NEW]: ob_get_status return value contains non-existing constants

From: Date: Fri, 29 Oct 2021 17:25:01 +0000
Subject: Bug #81566 [NEW]: ob_get_status return value contains non-existing constants
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237429@lists.php.net to get a copy of this message
From: pegasus at vaultwiki dot org Operating system: PHP version: master-Git-2021-10-29 (Git) Package: Output Control Bug Type: Bug Bug description:ob_get_status return value contains non-existing constants 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 bug report at https://bugs.php.net/bug.php?id=81566&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81566&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81566&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81566&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81566&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81566&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81566&r=support Expected behavior: https://bugs.php.net/fix.php?id=81566&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81566&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81566&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81566&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81566&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81566&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81566&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81566&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81566&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81566&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81566&r=mysqlcfg

« previous php.bugs (#237429) next »