PHP Warning on Cron Run in wp_mail
-
To test out the automatic update feature in trunk, I set up a cron job to run wp-cron.php twice a day. Since then, I’ve been receiving a warning email from the cron with the output:
<br /> <b>Notice</b>: Undefined index: SERVER_NAME in <b>/.../path/to/wp-includes/pluggable.php</b> on line <b>331</b><br />
Also, I noticed that the auto-update notification emails were being sent from “WordPress <wordpress@>”.
Line 331 in pluggable.php is found in wp_mail:
if ( !isset( $from_email ) ) { // Get the site domain and get rid of www. $sitename = strtolower( $_SERVER['SERVER_NAME'] ); // line 331 if ( substr( $sitename, 0, 4 ) == 'www.' ) { $sitename = substr( $sitename, 4 ); } $from_email = 'wordpress@' . $sitename; }
I would have thought this function would use
get_option('siteurl')
or similar, since SERVER_NAME isn’t guaranteed to be set when php is run from the command line.
Checking my production install (running WP 3.6.1), it seems the code is the same. I don’t see the warning emails coming from my production site (I’m guessing WP_DEBUG may have something to do with that).
Both my production and development sites are running on the same server.
- The topic ‘PHP Warning on Cron Run in wp_mail’ is closed to new replies.