Closed (fixed)
Project:
Drush
Version:
7.x-5.0-rc2
Component:
Base system (internal API)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2012 at 21:15 UTC
Updated:
1 Mar 2012 at 22:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
moshe weitzman commentedPlease follow the advice here when posting support requests.
Comment #2
greg.1.anderson commentedparse_url does not seem to work as described in #0.
I think the suggested patch is unnecessary.
Comment #3
greg.1.anderson commentedDid not mean to adjust status.
Comment #4
smokris@greg.1.anderson: My original post was unclear; it's not
parse_url("")that's the problem, it'sparse_url("http://")(which is what drush tries to do when$server_uriis emptystring). I get this output:@mosheweitzman: Sorry, I missed steps 3 and 4. Here's the output when running the command with
--debug:And the output of
drush status:Also possibly useful:
Comment #5
greg.1.anderson commentedThis is a php 5.2 issue. I don't get a warning for parse_url("http://") on my php 5.3 install, but I dug up an old server that still had 5.2 on it and confirmed the warning with
drush ev 'print_r(parse_url("http://"));'.However, I do -not- see this warning when I run drush (today's master) on php 5.2. I do see warnings when I run
drush version --uri='http://'(only on php 5.2), so perhaps this is a config problem.Comment #6
smokrisEr, how is this a config problem? I have no Drush config, and a standard PHP 5.2 config — isn't it a bug if Drush throws PHP warnings out-of-the-box?
Here's a shell transcript, demonstrating the problem occurring on PHP 5.2.9 (this time on a different, older, box) with the current Drush master branch:
Comment #7
greg.1.anderson commentedCan't reproduce what you're seeing. Also, if the problem is
parse_url('http://'), I don't see how the provided patch helps fix that problem.Comment #8
smokrisHere's the relevant bit of code as it currently exists in Drush master:
When the $server_uri passed to drush_conf_path() is emptystring, the first conditional, line 290, is false, so we jump to line 293. Line 293 works fine (no PHP warning), and returns an array. The conditional on line 294 evaluates to true (parse_url('') returns an array which does not include a scheme), so we try to do parse_url('http://' . $server_uri), which, since $server_uri is emptystring, evaluates to parse_url('http://'), which, as you confirmed in #5, generates a warning.
The patch in the original post modifies the first conditional, line 290, so that it evaluates to true when $server_uri is emptystring, so that we never try to parse the bogus 'http://' url. Since the patch avoids trying to parse the bogus 'http://' url, which produces a PHP warning, the patch therefore solves the problem described in the original post.
Comment #9
greg.1.anderson commentedI think that changing the 'isset' tests to 'empty' would be better.
Comment #10
smokrisSure. How's this?
Comment #11
greg.1.anderson commentedCommitted. Thanks.
Comment #12
smokrisGreat. Thank you.
Comment #13
paskainos commentedI experienced this problem too with
Drush 7.x-5.0-rc2/PHP 5.2.17. Switched toDrush 5.0-dev.