Project

General

Profile

Actions

Bug #95940

closed

Error on random urls which should show 404 page

Added by Stig Nørgaard Færch about 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2021-11-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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();
});


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #95586: PageNotFound handling doesn't work in debug modeClosedGeorg Ringer2021-10-12

Actions
Related to TYPO3 Core - Bug #94402: Don't issue second HTTP request for error handlingClosed2021-06-23

Actions
Actions #1

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.

Actions #2

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.

Actions #3

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.

Actions #4

Updated by Christian Eßl about 3 years ago

  • Priority changed from Should have to Must have
Actions #5

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

Actions #6

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

Actions #7

Updated by Christian Kuhn about 3 years ago

  • Related to Bug #95586: PageNotFound handling doesn't work in debug mode added
Actions #8

Updated by Christian Kuhn about 3 years ago

  • Related to Bug #94402: Don't issue second HTTP request for error handling added
Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Benni Mack about 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF