xref: /PHP-8.4/tests/output/ob_start_flags.phpt (revision 3ce7bf2a)
1--TEST--
2ob_start(): Ensure that user supplied handler type and status flags are erased
3--FILE--
4<?php
5define('PHP_OUTPUT_HANDLER_TYPE_INTERNAL', 0);
6define('PHP_OUTPUT_HANDLER_TYPE_USER', 1);
7
8ob_start(
9    fn ($s) => $s,
10    0,
11    PHP_OUTPUT_HANDLER_STDFLAGS |
12    PHP_OUTPUT_HANDLER_TYPE_INTERNAL |
13    PHP_OUTPUT_HANDLER_STARTED |
14    PHP_OUTPUT_HANDLER_DISABLED |
15    PHP_OUTPUT_HANDLER_PROCESSED
16);
17
18$bitmask = ob_get_status()['flags'];
19
20var_dump($bitmask & PHP_OUTPUT_HANDLER_STDFLAGS);
21var_dump($bitmask & PHP_OUTPUT_HANDLER_TYPE_USER);
22var_dump($bitmask & PHP_OUTPUT_HANDLER_STARTED);
23var_dump($bitmask & PHP_OUTPUT_HANDLER_DISABLED);
24var_dump($bitmask & PHP_OUTPUT_HANDLER_PROCESSED);
25?>
26--EXPECT--
27int(112)
28int(1)
29int(0)
30int(0)
31int(0)
32