Your project should not use native PHP response functions 5
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/symfony.use_php_response_function
- *
- * @throws PdfException if some data has already been output
- */
- protected function checkOutput(): void
- {
- if (\PHP_SAPI !== 'cli' && \headers_sent($file, $line)) {
- throw PdfException::format('Some data has already been output, can not send PDF file (output started at %s:%s).', $file, $line);
- }
- if (false !== \ob_get_length()) {
- // the output buffer is not empty
- $content = \ob_get_contents();
- {
- $disposition = $inline ? 'inline' : 'attachment';
- $encoded = $this->httpEncode('filename', $name, $isUTF8);
- \header('Pragma: public');
- \header('Content-Type: application/pdf');
- \header('Cache-Control: private, max-age=0, must-revalidate');
- \header(\sprintf('Content-Disposition: %s; %s', $disposition, $encoded));
- }
- /**
- protected function headers(string $name, bool $isUTF8, bool $inline): void
- {
- $disposition = $inline ? 'inline' : 'attachment';
- $encoded = $this->httpEncode('filename', $name, $isUTF8);
- \header('Pragma: public');
- \header('Content-Type: application/pdf');
- \header('Cache-Control: private, max-age=0, must-revalidate');
- \header(\sprintf('Content-Disposition: %s; %s', $disposition, $encoded));
- }
- $encoded = $this->httpEncode('filename', $name, $isUTF8);
- \header('Pragma: public');
- \header('Content-Type: application/pdf');
- \header('Cache-Control: private, max-age=0, must-revalidate');
- \header(\sprintf('Content-Disposition: %s; %s', $disposition, $encoded));
- }
- /**
- * Encode the given name/value pair parameter.
- */
- $disposition = $inline ? 'inline' : 'attachment';
- $encoded = $this->httpEncode('filename', $name, $isUTF8);
- \header('Pragma: public');
- \header('Content-Type: application/pdf');
- \header('Cache-Control: private, max-age=0, must-revalidate');
- \header(\sprintf('Content-Disposition: %s; %s', $disposition, $encoded));
- }
- /**
- * Encode the given name/value pair parameter.