There is code is services.runtime.inc that changes current directory:

$server_root = getcwd();
$drupal_path = services_get_server_info('drupal_path');
if (isset($drupal_path) && $drupal_path) {
   chdir($drupal_path);
}

But we set 'drupal_path' as current earlier in services.module:

services_set_server_info_from_array(array(
      'module'        => $server,
      'endpoint'      => $endpoint_name,
      'endpoint_path' => $endpoint->path,
      'debug'         => $endpoint->debug,
      'drupal_path'   => getcwd(),
    ));

So we actually don't change anything here.

Also minor remove global $user as it has been declared earlier in the same function.

I propose to remove this code completely.

Comments

marcingy’s picture

Status: Active » Needs review
ygerasimov’s picture

Rerolled patch attached

ygerasimov’s picture

Oh, #2 is wrong patch.

Here is proper one.

marcingy’s picture

Status: Needs review » Fixed

Ran some tests locally and tests still work that I tried (nodes).

Status: Fixed » Closed (fixed)

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