Issue Bug Closed

#98995Undefined array key "SYS_LASTCHANGED" in ContentObjectRenderer.php:1189

Christian Toffolo 11/03/22, 18:45 updated 02/08/23, 16:06

Description

Here in method ‘lastChanged’

(int)$tsfe->register['SYS_LASTCHANGED'])
should be:
@(int)($tsfe->register[‘SYS_LASTCHANGED’] ?? 0)@
?

Reviews 2

History 58

  1. Chris Müller commented 11/03/22, 19:46

    Can you give the scenario when the error occurs? Ideally, also a stack trace?

  2. Christian Toffolo commented 11/09/22, 18:54

    Also here should be:
    @(int)($this->register[‘SYS_LASTCHANGED’] ?? 0)@

  3. Christian Toffolo commented 11/09/22, 18:58

    To reproduce it, try to visit a page not already cached with a request like the ones from Google Bot with a code like:

    <?php
    declare(strict_types=1);
    
    googleBot('http://acme.com/');
    echo "done";
    
    /**
     * @param $url
     * @return bool|string
     */
    function googleBot($url): bool|string
    {
        $header = [];
        $header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
        $header[] = 'Cache-Control: max-age=0';
        $header[] = 'Content-Type: text/html; charset=utf-8';
        $header[] = 'Transfer-Encoding: chunked';
        $header[] = 'Connection: keep-alive';
        $header[] = 'Keep-Alive: 300';
        $header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
        $header[] = 'Accept-Language: en-us,en;q=0.5';
        $header[] = 'Pragma:';
    
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.5249.119 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
        curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
        curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
        curl_setopt($curl, CURLOPT_ENCODING, 'gzip, deflate');
        curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $body = curl_exec($curl);
        curl_close($curl);
        return $body;
    }
  4. Gerrit Code Review pushed patch set 1 for main to change 77329 status New Under Review 01/11/23, 10:41

  5. Gerrit Code Review pushed patch set 2 for main to change 77329 01/11/23, 10:43

  6. Gerrit Code Review pushed patch set 1 for 11.5 to change 77333 01/11/23, 13:59

  7. Christian Kuhn commented and changed status Under Review Resolved done 0 % 100 % 01/11/23, 14:05

    Applied in changeset commit:f3b1e7fab32637bbebbc49405e03759b07bb58f7.

  8. Benni Mack changed status Resolved Closed 02/08/23, 16:06