| @@ -44,15 +44,21 @@ | ||
| 44 | 44 | * |
| 45 | 45 | * @return void |
| 46 | 46 | */ |
| 47 | 47 | public function start() { |
| 48 | + if ( headers_sent() ) { | |
| 49 | + // Do not start the stream if headers have already been sent. | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + | |
| 48 | 53 | // Disable default disconnect checks. |
| 49 | 54 | ignore_user_abort( true ); |
| 50 | 55 | |
| 51 | 56 | // phpcs:disable WordPress.PHP.IniSet.Risky, WordPress.PHP.NoSilencedErrors.Discouraged |
| 52 | - @ini_set( 'zlib.output_compression', 0 ); | |
| 53 | - @ini_set( 'implicit_flush', 1 ); | |
| 54 | - @ini_set( 'log_limit', 8096 ); | |
| 57 | + @ini_set( 'zlib.output_compression', '0' ); | |
| 58 | + @ini_set( 'implicit_flush', '1' ); | |
| 59 | + @ini_set( 'log_limit', '8096' ); | |
| 60 | + | |
| 55 | 61 | @ob_end_clean(); |
| 56 | 62 | set_time_limit( 0 ); |
| 57 | 63 | // phpcs:enable WordPress.PHP.IniSet.Risky, WordPress.PHP.NoSilencedErrors.Discouraged |
| 58 | 64 | |
| @@ -132,9 +138,9 @@ | ||
| 132 | 138 | |
| 133 | 139 | /** |
| 134 | 140 | * Send an error to the client. |
| 135 | 141 | * |
| 136 | - * @param string $error Error message. | |
| 142 | + * @param array{message:string}|string $error Error message. | |
| 137 | 143 | * |
| 138 | 144 | * @return void |
| 139 | 145 | */ |
| 140 | 146 | public function send_error( $error ) { |
| @@ -146,7 +152,7 @@ | ||
| 146 | 152 | * |
| 147 | 153 | * @return bool |
| 148 | 154 | */ |
| 149 | 155 | public function should_abort() { |
| 150 | - return connection_aborted(); | |
| 156 | + return (bool) connection_aborted(); | |
| 151 | 157 | } |
| 152 | 158 | } |