I see this Notice a lot in --debug mode:

Returned: '[{"date":1326398266,"cmd":"core-status","opt":[],"major":"5","minor":"0-dev","os":"Darwin"} ]'
Expected: '[{"date":1326398266,"cmd":"core-status","opt":[],"major":"5","minor":"0-dev","os":"Darwin"}
]'

Note line break in second line. I am seeing it when using the commandfile at http://drupal.org/node/1246738#comment-5219204. Perhaps folks could install that and see if they get the same Notice. And leave the commandfile running please :)

Comments

moshe weitzman’s picture

To clarify, I get that Notice when running a command like `drush status --debug` while usage.drush5.inc is enabled.

greg.1.anderson’s picture

Here is the code that makes Drush's escapeshellarg different on Linux than PHP's escapeshellarg.

  // Replace "\t", "\n", "\r", "\0", "\x0B" with a whitespace.
  $arg = str_replace(array("\t", "\n", "\r", "\0", "\x0B"), ' ', $arg);

I am on php 5.3.6; I don't know if escapeshellarg might differ slightly from one version of php to another. I exepct I would have commented it if the implementation was deliberately different, so maybe this matches an older version of php. Didn't check this, though.

There are a number of ways we could fix this. I am a little worried that taking this out might cause problems for Drush on Windows. These characters rarely appear in command line args, and they could be preserved for Drush-to-Drush calls using method POST in backend invoke. I therefore do not think it would be too bad to just remove the warning and let the code differ (with an appropriate comment). To do otherwise would require a bunch of Windows testing, so if a change is desired, we should wait until after the Windows unit tests are in.

moshe weitzman’s picture

Title: Error in _drush_escapeshellarg_linux; » Notice in _drush_escapeshellarg_linux;
Priority: Normal » Minor

When you get a chance, please add that code comment and remove the notice

greg.1.anderson’s picture

Status: Active » Fixed

Finally remembered to do this. Committed cf5699e.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.