Skip to content

Commit 27b56e2

Browse files
authored
PR#98 with changelog entry added (#102)
2 parents 465045c + 598c20d commit 27b56e2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ See the main [README.md](./README.md#branch-and-version-naming) for the details
1111

1212
### Fixed
1313
- Restored SimpleSAMLphp exception handler (#29, #35)
14+
- Bootstrap Drupal correctly from inside SimpleSAMLphp (#75, #98)
1415

1516

1617
## [2.10.0-rc.1]

src/DrupalHelper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace SimpleSAML\Module\drupalauth;
44

55
use Drupal\Core\DrupalKernel;
6+
use Drupal\Core\Routing\RouteObjectInterface;
67
use Symfony\Component\HttpFoundation\Request;
8+
use Symfony\Component\Routing\Route;
79

810
class DrupalHelper
911
{
@@ -13,6 +15,8 @@ class DrupalHelper
1315
* Boot Drupal.
1416
*
1517
* @param string $drupalRoot Path to Drupal root.
18+
*
19+
* @see \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()
1620
*/
1721
public function bootDrupal(string $drupalRoot)
1822
{
@@ -22,7 +26,9 @@ public function bootDrupal(string $drupalRoot)
2226
chdir($drupalRoot);
2327
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', true, $drupalRoot);
2428
$kernel->boot();
25-
$kernel->loadLegacyIncludes();
29+
$request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
30+
$request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<none>');
31+
$kernel->preHandle($request);
2632
chdir($originalDir);
2733
\restore_exception_handler();
2834
\restore_error_handler();

0 commit comments

Comments
 (0)