Issue #3432768: use an empty string instead of null
1 unresolved thread
Closes #3432768
Merge request reports
Activity
268 268 $this->normalizeHeaders($message); 269 269 if (!empty($message['headers']) && is_array($message['headers'])) { 270 270 foreach ($message['headers'] as $header_key => $header_value) { 271 $header_value = $header_value ?? ''; 271 272 if (empty($header_key) || in_array($header_key, $headers_to_skip, FALSE)) { 272 273 continue; 273 274 } - Comment on lines 270 to 273
That approach wouldn't help, since it would e.g. try to create an address from an empty string, which would then lead to a different exception.
Instead, the whole loop should probably be skipped for empty header values. Something like this:
269 foreach ($message['headers'] as $header_key => $header_value) { 270 $header_value = $header_value ?? ''; 271 if (empty($header_key) || in_array($header_key, $headers_to_skip, FALSE)) { 272 continue; 273 } 269 foreach ($message['headers'] as $header_key => $header_value) { 270 if (empty($header_value) || empty($header_key) || in_array($header_key, $headers_to_skip, FALSE)) { 271 continue; 272 } Got it, thanks, makes sense.
Edited by aaron.ferris
Please register or sign in to reply