GithubHelp home page GithubHelp logo

PHP 8 support about phppgadmin HOT 11 OPEN

dgomezleon avatar dgomezleon commented on July 21, 2024
PHP 8 support

from phppgadmin.

Comments (11)

ormorph avatar ormorph commented on July 21, 2024 4

Hmm, these changes were enough for me to make everything work:

--- a/all_db.php        2020-11-07 09:09:12.000000000 +0300
+++ b/all_db.php        2021-03-08 17:44:57.760262808 +0300
@@ -199,7 +199,7 @@
                echo "\t\t<td class=\"data1\">\n";
                echo "\t\t\t<select name=\"formEncoding\">\n";
                echo "\t\t\t\t<option value=\"\"></option>\n";
-               while (list ($key) = each ($data->codemap)) {
+               foreach ($data->codemap as $key => $value) {
                    echo "\t\t\t\t<option value=\"", htmlspecialchars($key), "\"",
                                ($key == $_POST['formEncoding']) ? ' selected="selected"' : '', ">",
                                $misc->printVal($key), "</option>\n";
--- a/libraries/adodb/drivers/adodb-postgres64.inc.php  2020-11-07 09:09:12.000000000 +0300
+++ b/libraries/adodb/drivers/adodb-postgres64.inc.php  2021-03-08 08:08:31.886314599 +0300
@@ -122,6 +122,11 @@
        // changes the metaColumnsSQL, adds columns: attnum[6]
        }

+       function __construct()
+       {
+       // changes the metaColumnsSQL, adds columns: attnum[6]
+       }
+
        function ServerInfo()
        {
                if (isset($this->version)) return $this->version;

Php8 no longer uses each. Also, the classes no longer use the name of the constructor that is the same as the name of the class.
The ADOConnection class must be virtual, i.e. it should only be inherited, so it was not very good to remove this check from the class, as it was done in the new adodb:

die('Virtual Class -- cannot instantiate');

In a class that inherits from the ADOConnection class, you just need to override the constructor. It seems that the author's idea was simply not understood and was deleted.

from phppgadmin.

ndiazroncero avatar ndiazroncero commented on July 21, 2024 2

Hmm, these changes were enough for me to make everything work:

--- a/all_db.php        2020-11-07 09:09:12.000000000 +0300
+++ b/all_db.php        2021-03-08 17:44:57.760262808 +0300
@@ -199,7 +199,7 @@
                echo "\t\t<td class=\"data1\">\n";
                echo "\t\t\t<select name=\"formEncoding\">\n";
                echo "\t\t\t\t<option value=\"\"></option>\n";
-               while (list ($key) = each ($data->codemap)) {
+               foreach ($data->codemap as $key => $value) {
                    echo "\t\t\t\t<option value=\"", htmlspecialchars($key), "\"",
                                ($key == $_POST['formEncoding']) ? ' selected="selected"' : '', ">",
                                $misc->printVal($key), "</option>\n";
--- a/libraries/adodb/drivers/adodb-postgres64.inc.php  2020-11-07 09:09:12.000000000 +0300
+++ b/libraries/adodb/drivers/adodb-postgres64.inc.php  2021-03-08 08:08:31.886314599 +0300
@@ -122,6 +122,11 @@
        // changes the metaColumnsSQL, adds columns: attnum[6]
        }

+       function __construct()
+       {
+       // changes the metaColumnsSQL, adds columns: attnum[6]
+       }
+
        function ServerInfo()
        {
                if (isset($this->version)) return $this->version;

Php8 no longer uses each. Also, the classes no longer use the name of the constructor that is the same as the name of the class. The ADOConnection class must be virtual, i.e. it should only be inherited, so it was not very good to remove this check from the class, as it was done in the new adodb:

die('Virtual Class -- cannot instantiate');

In a class that inherits from the ADOConnection class, you just need to override the constructor. It seems that the author's idea was simply not understood and was deleted.

RESUME:

  1. Change 1:
  • because of php 8 policy > not available each use > foreach instead.
  • FILE: Root of tree Phppgadmin >>> File : all_db.php
  • CHANGE : LINE 202 complete sentence ... (list ($key) = each ($data->codemap)) { “ ...
    TO foreach ($data->codemap as $key => $value) {”
  1. Change 2:
  • because of php 8 policy > **not available **same name: constructor = class **** use > __constructor instead.
  • FILE: libraries/adodb/drivers >>> File : adbodb-postgres64inc.php
  • CHANGE: LINE 120 function ADODB_postgres64() to function __construct()
    BASICALLY

from phppgadmin.

vldmitrofanov avatar vldmitrofanov commented on July 21, 2024 1

It seems like this project is abandoned. At least no PRs were accepted yet to resolve this issue. I have created my own fork to support PHP 8.2 https://github.com/vldmitrofanov/phppgadmin-php8 as a temporary solution

from phppgadmin.

kzalewski avatar kzalewski commented on July 21, 2024 1

Hi @vldmitrofanov . I've been using the phpPgAdmin fork at https://github.com/ReimuHakurei/phpPgAdmin for the last year or so, and it has been working fine using PHP 8.1.x.

from phppgadmin.

xzilla avatar xzilla commented on July 21, 2024

This is entirely dependent on "someone" testing with php8 and then submitting fixes that work in a way that is compatible with 7.3+. We've had 1 PR so far, but it has issues and hasn't been tested, so there would seem to be some work to do.

TLDR; there is no ETA at this time.

from phppgadmin.

nirgal avatar nirgal commented on July 21, 2024

I ran phppgadmin successfully with PHP 8:

  • Using #126 to stop using each()
  • Upgrading adodb (just replace libraries/adodb by upstream library at https://github.com/ADOdb/ADOdb/. I tried successfully versions 5.20.19 and 5.21.1-beta1)
  • If using adodb 5.21, use #125 to update the way to get PG version. #125 also work with 5.20.19.
  • I had to change hasSequencePrivilege() function to have the regression test work, see #127. Most people won't see the difference.

I uploaded the result to Debian, FYI.

from phppgadmin.

vgout69 avatar vgout69 commented on July 21, 2024

I tried @nirgal 's solution and it works PERFECTLY !!!
Thank you very much !

from phppgadmin.

gavinangym avatar gavinangym commented on July 21, 2024

Created a pull request for PHP8 support. Incorporated all the changes mentioned by @nirgal .
Relevant ADOdb files updated in the libraries folder

from phppgadmin.

gessel avatar gessel commented on July 21, 2024

The above patch seems to work with FreeBSD/PHP 8.0.

from phppgadmin.

ormorph avatar ormorph commented on July 21, 2024

A few PRs have been added here that allow you to work with php8. But it just doesn't look like any of them will be merged. Large changes should be described, or divided into smaller commits. Otherwise it's hard to understand the code for mergeing PR.

from phppgadmin.

tnt avatar tnt commented on July 21, 2024

Just to mention: there's an apparently popular hack (not sure if this is related): https://stackoverflow.com/a/65891974/1547831

from phppgadmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.