I’m currently doing a major upgrade on a Nette based website. We have multiple custom DI extensions, custom ORM and use the Nittro UI framework. So the upgrade is quite involved.
Going from PHP 7.2 -> 8.4 and Nette 2.2 -> 3.2. I have been able to solve tens of errors, but not this one.
I get Non-static method NetteHttpRequestFactory::fromGlobals() cannot be called statically error whenever I try to load a page. This error (according to Tracy) seems to be coming from the following segment of the auto-generated DI container:
public function createServiceHttp__request(): NetteHttpRequest
{
return NetteHttpRequestFactory::fromGlobals();
}
The thing is, I don’t create the service anywhere, it’s Nette’s – and I guess, that it comes from NetteBridgesHttpDIHttpExtension line 56:
$request = $builder->addDefinition($this->prefix('request'))
->setFactory('@NetteHttpRequestFactory::fromGlobals');
I have tried going down ->setFactory – but I can’t even find it on the Definition class. More over I probably have misconfigured my debugger as it won’t stop on breakpoints in the cached container.
How do I fix this? Can I perhaps replace the http.request service with one of my own?
Thanks in advace!
This is part of my composer.json:
"require": {
"php": ">=8.4",
"ext-pdo": "*",
"ext-pdo_firebird": "*",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"nette/application": "3.2.*",
"nette/bootstrap": "3.2.*",
"nette/forms": "3.2.*",
"nette/http": "3.3.*",
"nette/security": "3.2.*",
"nette/di": ">=3.2",
"nette/caching": "3.3.*",
"nette/robot-loader": ">=4",
"tracy/tracy": ">=3",
"nittro/nette-bridges": "*",
"symfony/console": ">=7.3",
"latte/latte": ">=3",
"jahudka/porm": "^0.1.0",
"jahudka/component-events": "*"
}
(some of the things are linked from forked repos, not the public versions)