
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
* Cleans or flushes output buffers up to target level.
* Resulting level can be greater than target level if a non-removable buffer has been encountered.
public static function closeOutputBuffers(int $targetLevel, bool $flush): void
$status = ob_get_status(true);
$flags = \PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? \PHP_OUTPUT_HANDLER_FLUSHABLE : \PHP_OUTPUT_HANDLER_CLEANABLE);
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) {
* Marks a response as safe according to RFC8674.
* @see https://tools.ietf.org/html/rfc8674