Skip to content

Couple of problems with php8 #4

@james-stevens

Description

@james-stevens

I was getting a couple of issues running your code with php8 (v8.0.6)

The first was -> Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /opt/htdocs/admin.php:349

Its depreceated, so I've changed this

    if ( ! isset($magicQuotes) ) {
        $magicQuotes = get_magic_quotes_gpc();
    }

to this

    if ( ! isset($magicQuotes) ) {
        $magicQuotes = false;
    }

and that seems to fix it, def quick-and-dirty - I'm sure you can do better

I was also getting an error on line 991 of browser.php saying status was not an int

  PHP Warning:  curl_exec(): Could not call the CURLOPT_WRITEFUNCTION in /opt/htdocs/browse.php on line 877
  PHP Fatal  error:  Uncaught TypeError: header(): Argument #3 ($response_code) must be of type int, string given in /opt/htdocs/browse.php:991     

I fixed this by added a line to check the header line starts Status: before grabbing the status, now the proxy mostly works - It seems really odd that the status thing wasn't a problem before - I'm obviously missing something you've done elsewhere, or how the old library worked??

anyway, this

    # Extract the status code (can occur more than once if 100 continue)
    if ( $this->status == 0 || ( $this->status == 100 && ! strpos($header, ':') ) ) {
        $this->status = substr($header, 9, 3);
    }

become this

    # Extract the status code (can occur more than once if 100 continue)
    if ( $this->status == 0 || ( $this->status == 100 && ! strpos($header, ':') ) ) {
        if ( substr($header,0,8) == 'Status: ')
            $this->status = intval(substr($header, 9, 3));
    }

So now it's mostly working, but I seem to be getting either a very old version of the sites or maybe the mobile version, or an old mobile version? Or maybe the version of the site when it can't find out enough about the client?

I can't see anything obvious in the admin that might fix the web page formatting - any idea???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions