Title: PHP Warning in Header
Last modified: February 2, 2023

---

# PHP Warning in Header

 *  Resolved [jahrat](https://wordpress.org/support/users/jahrat/)
 * (@jahrat)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/)
 * I recently added your plugin to my website as I have two separate podcasts to
   share. The plugin apparently works fine but I keep getting the following error
   in my debug log.
 * **_PHP Warning: Header may not contain more than a single header, new line detected
   in /…/wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/
   class-frontend-controller.php on line 1044_**
 * Is this an error on my settings? How do I fix this?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-in-header-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [jahrat](https://wordpress.org/support/users/jahrat/)
 * (@jahrat)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16438140)
 * Checking the debug log again today I found additional error listed.
 * **_PHP Warning: Undefined array key 2 in /…/wp-includes/feed.php on line 484
   
   PHP Warning: Undefined array key 1 in /…/wp-includes/feed.php on line 494
   _
 * Not sure if this is related to the earlier warning or if this is a n additional
   warning.
 * What is the recommendation?
 *  Plugin Author [Serhiy Zakharchenko](https://wordpress.org/support/users/zahardoc/)
 * (@zahardoc)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16445488)
 * Hi [@jahrat](https://wordpress.org/support/users/jahrat/)! 
   Thank you for bringing
   it to our attention.It looks like your audio file path contains newlines in it.
   I’m not sure why it is happening and I couldn’t reproduce it, but please try 
   putting this string after `$file = str_replace( ' ', '%20', $file );` in _…/wp-
   content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-
   controller.php_ on line 1041:
 *     ```wp-block-code
       $file = str_replace( PHP_EOL, '', $file );
       ```
   
 * If it helps, we’ll include that code in our next plugin release.
   Regarding second
   warning, it goes from the WordPress core code, and I’m not sure if we can help
   you to fix it now. Usually, that function should not be called if you use our
   SSP feed template ( [https://the-mcaj.org/feed/podcast/](https://the-mcaj.org/feed/podcast/)).
 *  Thread Starter [jahrat](https://wordpress.org/support/users/jahrat/)
 * (@jahrat)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16448680)
 * I added the string as requested and I have not seen the fault repeated. The other
   errors related to the WordPress core are still there but not the fault for your
   plugin.
 * I will consider this closed and will continue to trouble shoot my other errors.
 * Thanks.
 *  Plugin Author [Serhiy Zakharchenko](https://wordpress.org/support/users/zahardoc/)
 * (@zahardoc)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16451922)
 * [@jahrat](https://wordpress.org/support/users/jahrat/) Cool, thank you for your
   feedback!
 *  [psimatrix](https://wordpress.org/support/users/psimatrix/)
 * (@psimatrix)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16690646)
 * We were experiencing this same exact issue, even after the latest release with
   the above patch.
 * I replaced the code on line 1044 and suggest it be included in the next release:
 * `$file = preg_replace(['/[\r\n]{2,}/','/[\r]/','/[\n]/', PHP_EOL], '', trim($
   file));`
 * This should catch all carriage returns and end of file characters that could 
   get injected due to copy/paste into the editor.
   Additional note, it would be 
   better if line 972 used:`$is_url = filter_var($file, FILTER_VALIDATE_URL);`
 * Instead of:
 * `$is_url = 0 === strpos( $file, 'http' );`
 * This would catch the issue earlier.
    -  This reply was modified 3 years, 1 month ago by [psimatrix](https://wordpress.org/support/users/psimatrix/).
 *  Plugin Author [Serhiy Zakharchenko](https://wordpress.org/support/users/zahardoc/)
 * (@zahardoc)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-16878092)
 * Thank you [@psimatrix](https://wordpress.org/support/users/psimatrix/) !
 *  [dolceremy](https://wordpress.org/support/users/centoasa/)
 * (@centoasa)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-17129398)
 * still this error for me with php 8.2.9
 *  [claschy](https://wordpress.org/support/users/claschy/)
 * (@claschy)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-17535557)
 * Still getting this error – hundreds a day – can you help?
 * [28-Mar-2024 14:36:24 UTC] PHP Warning: Undefined array key 2 in /home/public_html/
   wp-includes/feed.php on line 484
   [28-Mar-2024 14:36:24 UTC] PHP Warning: Undefined
   array key 1 in /home/public_html/wp-includes/feed.php on line 494
 * The above fix is present in class-frontend-controller.php, but I can’t see where
   [@psimatrix](https://wordpress.org/support/users/psimatrix/) fix would go, as
   line 1044 is related to rss meta tag.
 * Feed not showing any errors: [https://www.worldturnedupsidedown.co.uk/feed/podcast/the-world-turned-upside-down/](https://www.worldturnedupsidedown.co.uk/feed/podcast/the-world-turned-upside-down/)
 * WordPress 6.4.3
   Seriously Simple Podcasting 3.2.0
 *  [dolceremy](https://wordpress.org/support/users/centoasa/)
 * (@centoasa)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-17535716)
 * for incompatibility with my translation plugin I’m using php 7.4 and this issue
   is not present with 7.4

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘PHP Warning in Header’ is closed to new replies.

 * ![](https://ps.w.org/seriously-simple-podcasting/assets/icon-256x256.png?rev=
   970355)
 * [Seriously Simple Podcasting](https://wordpress.org/plugins/seriously-simple-podcasting/)
 * [Support Threads](https://wordpress.org/support/plugin/seriously-simple-podcasting/)
 * [Active Topics](https://wordpress.org/support/plugin/seriously-simple-podcasting/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seriously-simple-podcasting/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seriously-simple-podcasting/reviews/)

 * 9 replies
 * 5 participants
 * Last reply from: [dolceremy](https://wordpress.org/support/users/centoasa/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/php-warning-in-header-2/#post-17535716)
 * Status: resolved