Skip to content

Commit

Permalink
Merge branch '2.7'
Browse files Browse the repository at this point in the history
* 2.7:
  [Form] NativeRequestHandler file handling fix
  [VarDumper] Workaround stringy numeric keys
  [HttpKernel] Throw double-bounce exceptions
  [FrameworkBundle] silence E_USER_DEPRECATED in insulated clients
  [minor] composer.json fix
  [minor] composer.json fix
  Fixed absolute_url for absolute paths
  minor #13377 [Console] Change greater by greater or equal for isFresh in FileResource
  [2.3] [HttpFoundation] fixed param order for Nginx's x-accel-redirect
  • Loading branch information
nicolas-grekas committed Feb 25, 2015
2 parents 99e4cc1 + e3287dc commit c7be91c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Extension/HttpFoundationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public function generateAbsoluteUrl($path)
$prefix = substr($prefix, 0, $pos).'/';
}

$path = $prefix.$path;
return $request->getUriForPath($prefix.$path);
}

return $request->getUriForPath($path);
return $request->getSchemeAndHttpHost().$path;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions Tests/Extension/HttpFoundationExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ public function getGenerateAbsoluteUrlData()
);
}

public function testGenerateAbsoluteUrlWithScriptFileName()
{
$request = Request::create('http://localhost/app/web/app_dev.php');
$request->server->set('SCRIPT_FILENAME', '/var/www/app/web/app_dev.php');

$stack = new RequestStack();
$stack->push($request);
$extension = new HttpFoundationExtension($stack);

$this->assertEquals(
'http://localhost/app/web/bundles/framework/css/structure.css',
$extension->generateAbsoluteUrl('/app/web/bundles/framework/css/structure.css')
);
}

/**
* @dataProvider getGenerateRelativePathData()
*/
Expand Down

0 comments on commit c7be91c

Please sign in to comment.