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!
8 responses to “WordPress Error Fix: Unable to Parse URL”
Now located in: /wp-includes/script-loader.php > rule #534
Awesome, Bart — thank you for the updated information. :)
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?
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.
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.
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.
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
Thanks for the information Jon :)