Strange error on core files (5.1)

Silverstripe Version:
5.1 on php 8.2

Question:
I get an error on dev build:
Fatal error : Declaration of SilverStripe\CMS\Controllers\ContentController::handleRequest(SilverStripe\Control\HTTPRequest $request) must be compatible with SilverStripe\Control\Controller::handleRequest(SilverStripe\Control\HTTPRequest $request): SilverStripe\Control\HTTPResponse in F:\xampp\htdocs\hospitalhome\vendor\silverstripe\cms\code\Controllers\ContentController.php on line 193

Since they are both core files from vendor folder, I dont want to touch them directly.
Any ideas maybe?

Thanks in advance,
Lars

// Include any relevant code. If you have a lot of code, link to a gist instead.

Okay, but 5.1 of which module?

This sounds like you have a mismatch between your version of silverstripe/framework and silverstripe/cms.

Try deleting your vendor/ directory and composer.lock file completely and running composer install from there - that way composer won’t care what you already had installed and should install compatible versions of things.

Thank you Guy!
I did that, now I get a new error within the cms:
Fatal error : Declaration of SilverStripe\CMS\Model\RedirectorPageController::index(SilverStripe\Control\HTTPRequest $request) must be compatible with PageController::index() in F:\xampp\htdocs\hospitalhome\vendor\silverstripe\cms\code\Model\RedirectorPageController.php on line 20
So something is still wrong there.
Here are my dependencies:
“require”: {
“php”: “>=8.2.0”,

    "statickidz/php-google-translate-free": "^1.0",

    "mangopay/php-sdk-v2": "^3.0",

    "silverstripe/framework": "^5.1",

    "dnadesign/silverstripe-elemental": "^5.1",

    "silverstripe/cms": "^5.1"
},

"require-dev": {
    "phpunit/phpunit": "^9.5"
},

In theory /cms 5.1 should work on ss5.1 I think?

Follow up.
I had to include use SilverStripe\Control\HTTPRequest; in all my controllers, derived from pagecontroller, and had to put the HTTP Request parameter in all index functions;
public function index(HTTPRequest $request)

After changing every index function, I came a bit further, but I now get a new error wich I cant predict:

[Emergency] Uncaught Error: Class “IntlDateFormatter” not found

php -m tells me that intl extension is loaded, dev/build goes through with no error, but after loading pagecontroller:index, it breaks just.before outputting the template.
There are only DB read actions done in this function, no writing is made.
Within this function there are no DateTime operations executed.
Even if I return the template in the first line of the index function, and the template only contains one textword, I get this error.

Any ideas would be really appreciated, I have no idea of where to start now+ !!!

The intl extension is not loaded when Silverstripe runs, regardless of what php -m says.
A better way to check would be by putting phpinfo(); exit(0); at the top of your index.php and checking the results in your browser, just to be sure you are checking the proper PHP configuration.

1 Like

I was checking phpinfo, and in this mentioned php.ini intl was active.
BUT I had 2 xampp installations on my server, so apparently the one with php 8.x somehow loaded something from the 7.2, or whatever.

Solution: Deleted both installations, and installed a new xampp, now all works fine, I only need to update my SS4 code to 5

1 Like