Latest TweetsVerify any search engine or visitor via CLI Forward-Reverse Lookup perishablepress.com/cli-forwar…
Perishable Press

WordPress Error Fix: Unable to Parse URL

For those of you running an older version of WordPress that is generating errors that look like any of these fabricated examples:

Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067

You can easily resolve the issue by suppressing these errors, which are automatically generated whenever the parse_url() function tries to parse an empty value for the URL. To silence the errors, open the file wp-includes/functions.php and locate the following code (around line #1067):

$parsed = parse_url('http://' . $value['url']);

In that line, place an “@” symbol before the “parse_url” like so:

$parsed = @parse_url('http://' . $value['url']);

And that should do it. The “@” symbol works to suppress any errors generated by the parse_url() function. So say goodbye to those relentless PHP errors. Additionally, you might want to make a note of the change somewhere just in case you decide you upgrade or reinstall WordPress. Cheers!

Note: This information is intended primarily for WordPress versions previous to 2.3, but may be applicable in other versions as well. Not recommended to modify the WP core in newer/current versions of WordPress.

Jeff Starr
About the Author Jeff Starr = Web Developer. Book Author. Secretly Important.
Archives
8 responses
  1. Bart Gysens June 15, 2009 @ 5:03 am

    Now located in: /wp-includes/script-loader.php > rule #534

  2. Jeff Starr

    Awesome, Bart — thank you for the updated information. :)

  3. Is there a more solid solution? What’s actually causing that error? I’m wary of simply suppressing the errors, I’m more interested in solving the cause for such errors. Any suggestions?

    One interesting thing is the port its using is not correct. For my local testing purposes I’m running on port 10088, not 100881. Maybe this has something to do with it?

  4. Jeff Starr

    I wish I knew.. I guess I stopped worrying about this once the errors stopped appearing in my log files, but it would be good to actually resolve the error. I recall spending a great deal of time trying to locate the source of the issue, but eventually settled for suppression after not being able to pin it down.

    I do know that this only seems to effect older WordPress, and hasn’t been an issue for me with more recent versions. So that would be one recommendation, assuming you haven’t already upgraded.

    As for the port, I eliminated that as a possible variable back when I was researching this issue, not to say that it isn’t a possible factor in your situation.

  5. That’s what’s strange to me. I’ve got the latest version of WordPress, 2.8.4. I’m trying it into a site using xcart but the wordpress files have no ties to the xcart site, they just coexist in the same directory and database table.

    It’s not of pressing concern right now but if I get some time I’ll do some research and let you guys know what I discover.

  6. This is still an issue in 2.9.2, which I downloaded only yesterday. Looks like it is a rare bug though – it only happens if the URL operates on a range of high port numbers. If a “1” can be concatenated to the end of your port number to make it invalid, an error will result. I believe port numbers cannot be larger than 65535.

    The solution can be found in the supplied link.

  7. And the link (which crashed commenting in the last post) is thus:

    http://www.hashbangcode.com/blog/parse_url-warning-bug-in-wordpress-2-9-2-2566.html

  8. Jeff Starr

    Thanks for the information Jon :)

[ Comments are closed for this post ]