litespeedtech / litespeedtech/lscache-drupal

Undefined constant MAIN_REQUEST

Open
#34 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
15
Forks
19
PR merge metrics
No merged PRs in 30d

Description

After upgrading Litespeed from 1.2 to 1.3, I am getting WSOD. Upon checking the logs, I see this:

```
php Error: Undefined constant Drupal\lite_speed_cache\StackMiddleware\LiteSpeedCache::MAIN_REQUEST in
Drupal\lite_speed_cache\StackMiddleware\LiteSpeedCache->handle() (line 109 of...
```

I can see from [this latest commit](https://github.com/litespeedtech/lscache-drupal/commit/47dbd9309ded793c6c91775d4fc8b88b76524c09#diff-fc50bfa67758aba34bb91d53a9c0b01a69ccee7a30415577c99abd5f35e748b9R109) that MAIN_REQUEST is being used instead of MASTER_REQUEST.

MASTER_REQUEST is required for HttpKernelInterface:

```
interface HttpKernelInterface
{
public const MASTER_REQUEST = 1;
public const SUB_REQUEST = 2;

/**
* Handles a Request to convert it to a Response.
*
* When $catch is true, the implementation must catch all exceptions
* and do its best to convert them to a Response instance.
*
* @param int $type The type of the request
* (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
* @param bool $catch Whether to catch exceptions or not
*
* @return Response A Response instance
*
* @throws \Exception When an Exception occurs during processing
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
}
```

Would be great if this can be fixed asap as I cannot use Litespeed anymore. I'll need to revert to 1.2 for now.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Drupal\lite_speed_cache\StackMiddleware\LiteSpeedCache->handle() around line 109 and compare the latest commit linked in the issue with the HttpKernelInterface constants shown here. Done means the middleware no longer raises the undefined MAIN_REQUEST error after upgrading to LiteSpeed 1.3.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.