Bug #95940
closedError on random urls which should show 404 page
100%
Description
When requesting an address which should return 404, sometimes instead another error is displayed.
I've found no consistency on when this happens. I can request an address and the 404 is shown, but next time the same page will give the other error instead:
1/1) TypeError
fseek() expects parameter 1 to be resource, int given
in /var/www/html/vendor/guzzlehttp/psr7/src/Stream.php line 210
}
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
}
if (fseek($this->stream, $offset, $whence) === -1) {
throw new \RuntimeException('Unable to seek to stream position '
. $offset . ' with whence ' . var_export($whence, true));
}
}
at fseek()
in /var/www/html/vendor/guzzlehttp/psr7/src/Stream.php line 210
}
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
}
if (fseek($this->stream, $offset, $whence) === -1) {
throw new \RuntimeException('Unable to seek to stream position '
. $offset . ' with whence ' . var_export($whence, true));
}
}
at GuzzleHttp\Psr7\Stream->seek()
in /var/www/html/vendor/guzzlehttp/psr7/src/Stream.php line 81
public function __toString(): string
{
try {
if ($this->isSeekable()) {
$this->seek(0);
}
return $this->getContents();
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
at GuzzleHttp\Psr7\Stream->__toString()
in /var/www/html/public/typo3/sysext/core/Classes/Http/AbstractApplication.php line 75
if ($body instanceof SelfEmittableStreamInterface) {
// Optimization for streams that use php functions like readfile() as fastpath for serving files.
$body->emit();
} else {
echo $body->__toString();
}
}
/**
at TYPO3\CMS\Core\Http\AbstractApplication->sendResponse()
in /var/www/html/public/typo3/sysext/core/Classes/Http/AbstractApplication.php line 107
} catch (ImmediateResponseException $exception) {
$response = $exception->getResponse();
}
$this->sendResponse($response);
}
}
at TYPO3\CMS\Core\Http\AbstractApplication->run()
in /var/www/html/public/index.php line 20
// Set up the application for the frontend
call_user_func(static function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_FE);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader)->get(\TYPO3\CMS\Frontend\Http\Application::class)->run();
});
at {closure}()
in /var/www/html/public/index.php line 21
call_user_func(static function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_FE);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader)->get(\TYPO3\CMS\Frontend\Http\Application::class)->run();
});
Updated by Tim Schreiner about 3 years ago
I have the same error using TYPO3 11.5.2. Rolling back to TYPO3 11.5.1, the problem disappears.
Updated by Tim Schreiner about 3 years ago
The problem was introduced by the bugfix https://github.com/TYPO3/typo3/commit/502b6d4f02edc7e7169b0cc631576036691f7055.
The main problem is, that the whole response, including a stream, is going to be cached. The cached stream returns 0 instead of a stream when calling the 404 page from cache and leads to the described problem.
The 404 page works the first time when it is not cached. Before the mentioned bugfix, the 404 page was never cached and therefore it worked.
Updated by Tim Schreiner about 3 years ago
The priority should be set to "must have" because this bug applies to all TYPO3 11.5.2 installations that use the PageContentErrorHandler which might be a quite common use-case.
Updated by Christian Eßl about 3 years ago
- Priority changed from Should have to Must have
Updated by Gerrit Code Review about 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72184
Updated by Gerrit Code Review about 3 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72184
Updated by Christian Kuhn about 3 years ago
- Related to Bug #95586: PageNotFound handling doesn't work in debug mode added
Updated by Christian Kuhn about 3 years ago
- Related to Bug #94402: Don't issue second HTTP request for error handling added
Updated by Gerrit Code Review about 3 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72184
Updated by Gerrit Code Review about 3 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72184
Updated by Gerrit Code Review about 3 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72184
Updated by Benni Mack about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 88122436e5eaca2e29354d41f2981f853ed8f5d9.