Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 compatibility #16746

Closed
10 tasks done
williamdes opened this issue Mar 20, 2021 · 26 comments
Closed
10 tasks done

PHP 8.1 compatibility #16746

williamdes opened this issue Mar 20, 2021 · 26 comments
Assignees
Labels
Bug A problem or regression with an existing feature waiting on upstream Issues blocked by a third-party
Projects
Milestone

Comments

@williamdes
Copy link
Member

williamdes commented Mar 20, 2021

Describe the bug

Added to CI by #16743

To be fixed

testsuite errors

There was 1 error:

1) PhpMyAdmin\Tests\Controllers\Database\StructureControllerTest::testDisplayTableList
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/Error/Error.php:175
/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/Error/Error.php:111
/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/Template.php:409
/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/Template.php:367
/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/Template.php:379
/home/runner/work/phpmyadmin/phpmyadmin/vendor/twig/twig/src/TemplateWrapper.php:40
/home/runner/work/phpmyadmin/phpmyadmin/libraries/classes/Template.php:129
/home/runner/work/phpmyadmin/phpmyadmin/libraries/classes/Controllers/Database/StructureController.php:685
/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Controllers/Database/StructureControllerTest.php:541
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

--

There were 11 failures:

1) PhpMyAdmin\Tests\Controllers\Server\BinlogControllerTest::testIndex
Failed asserting that '<h2>\n
  <img src="themes/dot.gif" title="" alt="" class="icon ic_s_tbl">\n
  Binary log</h2>\n
\n
<form action="index.php?route=/server/binlog&amp;server=1&amp;lang=en" method="post">\n
  <input type="hidden" name="log" value="index1"><input type="hidden" name="server" value="1"><input type="hidden" name="lang" value="en"><input type="hidden" name="token" value="token">\n
  <fieldset>\n
    <legend>\n
      Select binary log to view    </legend>\n
\n
        <select name="log">\n
              <option value="index1" selected>\n
          index1\n
                      (100 B)\n
                              </option>\n
              <option value="index2">\n
          index2\n
                      (200 B)\n
                              </option>\n
          </select>\n
    2\n
    Files,\n
          300 B\n
      </fieldset>\n
\n
  <fieldset class="tblFooters">\n
    <input class="btn btn-primary" type="submit" value="Go">\n
  </fieldset>\n
</form>\n
\n
<div class="result_query">\n
<div class="alert alert-success" role="alert">\n
  <img src="themes/dot.gif" title="" alt="" class="icon ic_s_success"> Your SQL query has been executed successfully.\n
</div>\n
<div class="sqlOuter"><code class="sql"><pre>\n
SHOW BINLOG EVENTS IN &#039;index1&#039; LIMIT 3, 10\n
</pre></code></div><div class="tools print_ignore"><form action="index.php?route=/sql&amp;server=1&amp;lang=en" method="post"><input type="hidden" name="db" value="db"><input type="hidden" name="table" value="table"><input type="hidden" name="server" value="1"><input type="hidden" name="lang" value="en"><input type="hidden" name="token" value="token"><input type="hidden" name="sql_query" value="SHOW BINLOG EVENTS IN &#039;index1&#039; LIMIT 3, 10"><input type="hidden" name="profiling_form" value="1"><input type="checkbox" name="profiling" id="profilingCheckbox" class="autosubmit"> <label for="profilingCheckbox">Profiling</label></form> [&nbsp;<a href="#" class="inline_edit_sql">Edit inline</a>&nbsp;] [&nbsp;<a href="index.php" data-post="route=/table/sql&amp;server=1&amp;lang=en&amp;db=db&amp;table=table&amp;sql_query=SHOW+BINLOG+EVENTS+IN+%27index1%27+LIMIT+3%2C+10&amp;show_query=1&amp;server=1&amp;lang=en">Edit</a>&nbsp;] [&nbsp;<a href="index.php" data-post="route=/import&amp;db=db&amp;table=table&amp;sql_query=SHOW+BINLOG+EVENTS+IN+%27index1%27+LIMIT+3%2C+10&amp;show_query=1&amp;show_as_php=1&amp;server=1&amp;lang=en">Create PHP code</a>&nbsp;] [&nbsp;<a href="index.php" data-post="route=/sql&amp;db=db&amp;table=table&amp;sql_query=SHOW+BINLOG+EVENTS+IN+%27index1%27+LIMIT+3%2C+10&amp;show_query=1&amp;server=1&amp;lang=en">Refresh</a>&nbsp;]</div></div>\n
\n
<table class="pma-table" id="binlogTable">\n
  <thead>\n
    <tr>\n
      <td colspan="6" class="text-center">\n
                              <a href="index.php?route=/server/binlog&amp;server=1&amp;lang=en" data-post="log=index1&amp;server=1&amp;lang=en" title="Previous">\n
              &laquo;\n
            </a>\n
                    -\n
        \n
                  <a href="index.php?route=/server/binlog&amp;server=1&amp;lang=en" data-post="log=index1&amp;pos=3&amp;is_full_query=1&amp;server=1&amp;lang=en" title="Show full queries">\n
            <img src="./themes/pmahomme/img/s_fulltext.png" alt="Show full queries">\n
          </a>\n
        \n
              </td>\n
    </tr>\n
    <tr>\n
      <th>Log name</th>\n
      <th>Position</th>\n
      <th>Event type</th>\n
      <th>Server ID</th>\n
      <th>Original position</th>\n
      <th>Information</th>\n
    </tr>\n
  </thead>\n
\n
  <tbody>\n
          <tr class="noclick">\n
        <td>index1_Log_name</td>\n
        <td class="right">index1_Pos</td>\n
        <td>index1_Event_type</td>\n
        <td class="right">index1_Server_id</td>\n
        <td class="right">index1_Orig_log_pos</td>\n
        <td><code class="sql"><pre>\n
index1_Info\n
</pre></code></td>\n
      </tr>\n
      </tbody>\n
</table>\n
' contains "SHOW BINLOG EVENTS IN 'index1' LIMIT 3, 10".

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Controllers/Server/BinlogControllerTest.php:70
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

2) PhpMyAdmin\Tests\InsertEditTest::testGetSpecialCharsAndBackupFieldForExistingRow
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => false
     1 => ''
-    2 => ''','
+    2 => '&#039;&#039;,'
     3 => null
-    4 => '<input type="hidden" name="fields_preva" value="'',">'
+    4 => '<input type="hidden" name="fields_preva" value="&#039;&#039;,">'
 )

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/InsertEditTest.php:2588
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

3) PhpMyAdmin\Tests\Server\PrivilegesTest::testUpdatePassword
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'The password for 'pma_username'@'pma_hostname' was changed successfully.'
+'The password for &#039;pma_username&#039;@&#039;pma_hostname&#039; was changed successfully.'

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Server/PrivilegesTest.php:607
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

4) PhpMyAdmin\Tests\Server\PrivilegesTest::testGetMessageAndSqlQueryForPrivilegesRevoke
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'You have revoked the privileges for 'pma_username'@'pma_hostname'.'
+'You have revoked the privileges for &#039;pma_username&#039;@&#039;pma_hostname&#039;.'

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Server/PrivilegesTest.php:637
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

5) PhpMyAdmin\Tests\Server\PrivilegesTest::testUpdatePrivileges
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'You have updated the privileges for 'pma_username'@'pma_hostname'.'
+'You have updated the privileges for &#039;pma_username&#039;@&#039;pma_hostname&#039;.'

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Server/PrivilegesTest.php:673
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

6) PhpMyAdmin\Tests\Server\PrivilegesTest::testUpdatePrivilegesBeforeMySql8Dot11
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'You have updated the privileges for 'pma_username'@'pma_hostname'.'
+'You have updated the privileges for &#039;pma_username&#039;@&#039;pma_hostname&#039;.'

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Server/PrivilegesTest.php:723
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

7) PhpMyAdmin\Tests\Server\PrivilegesTest::testUpdatePrivilegesAfterMySql8Dot11
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'You have updated the privileges for 'pma_username'@'pma_hostname'.'
+'You have updated the privileges for &#039;pma_username&#039;@&#039;pma_hostname&#039;.'

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/Server/PrivilegesTest.php:774
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

8) PhpMyAdmin\Tests\UtilTest::testExtractColumnSpec with data set #0 ('SET('a','b')', array('set', 'set('a', 'b')', false, false, false, ''a','b'', array('a', 'b'), ' ', true, 'set('a', 'b')'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'enum_set_values' => Array (...)
     'attribute' => ' '
     'can_contain_collation' => true
-    'displayed_type' => 'set('a', 'b')'
+    'displayed_type' => 'set(&#039;a&#039;, &#039;b&#039;)'
 )

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/UtilTest.php:754
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

9) PhpMyAdmin\Tests\UtilTest::testExtractColumnSpec with data set #1 ('SET('\'a','b')', array('set', 'set('\'a', 'b')', false, false, false, ''\'a','b'', array(''a', 'b'), ' ', true, 'set('\'a', 'b')'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'enum_set_values' => Array (...)
     'attribute' => ' '
     'can_contain_collation' => true
-    'displayed_type' => 'set('\'a', 'b')'
+    'displayed_type' => 'set(&#039;\&#039;a&#039;, &#039;b&#039;)'
 )

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/UtilTest.php:754
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

10) PhpMyAdmin\Tests\UtilTest::testExtractColumnSpec with data set #2 ('SET('''a','b')', array('set', 'set('''a', 'b')', false, false, false, ''''a','b'', array(''a', 'b'), ' ', true, 'set('''a', 'b')'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'enum_set_values' => Array (...)
     'attribute' => ' '
     'can_contain_collation' => true
-    'displayed_type' => 'set('''a', 'b')'
+    'displayed_type' => 'set(&#039;&#039;&#039;a&#039;, &#039;b&#039;)'
 )

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/UtilTest.php:754
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

11) PhpMyAdmin\Tests\UtilTest::testExtractColumnSpec with data set #3 ('ENUM('a&b', 'b''c\'d', 'e\\f')', array('enum', 'enum('a&b', 'b''c\'d', 'e\\f')', false, false, false, ''a&b', 'b''c\'d', 'e\\f'', array('a&b', 'b'c'd', 'e\f'), ' ', true, 'enum('a&amp;b', 'b''c\'d', 'e\\f')'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'enum_set_values' => Array (...)
     'attribute' => ' '
     'can_contain_collation' => true
-    'displayed_type' => 'enum('a&amp;b', 'b''c\'d', 'e\\f')'
+    'displayed_type' => 'enum(&#039;a&amp;b&#039;, &#039;b&#039;&#039;c\&#039;d&#039;, &#039;e\\f&#039;)'
 )

/home/runner/work/phpmyadmin/phpmyadmin/test/classes/UtilTest.php:754
/home/runner/work/phpmyadmin/phpmyadmin/vendor/phpunit/phpunit/phpunit:61

--

ERRORS!
Tests: 2503, Assertions: 8289, Errors: 1, Failures: 11, Warnings: 60, Skipped: 1.

Server configuration

  • PHP version: 8.1
  • phpMyAdmin version: 5.1
@williamdes williamdes added Bug A problem or regression with an existing feature waiting on upstream Issues blocked by a third-party labels Mar 20, 2021
@williamdes williamdes added this to Needs triage in issues via automation Mar 20, 2021
@williamdes williamdes moved this from Needs triage to Reproduced in issues Mar 20, 2021
williamdes referenced this issue in phpmyadmin/twig-i18n-extension Jun 10, 2021
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
@williamdes
Copy link
Member Author

williamdes commented Sep 8, 2021

This did pop out in my Sentry emails for a user using php_version = 8.1.0RC2-dev

cc @Ayesh

@osxtra

This comment has been minimized.

@williamdes
Copy link
Member Author

As @silverqx mentioned in #17219 (comment) there is still some PHP 8.1 deprecations as Twig did drop support for PHP 7.1 before releasing the fix for PHP 8.1: twigphp/Twig@47201dc#diff-d990abf52f11cd3e401869f86fb8ce9b4d7f966b0649372f4b95d23d9a88e249R40

This will make the next phpMyAdmin 5.1 non PHP 8.1 compatible, at least for people installing from our distributed bundles that start to be compatible at PHP 7.1.
So phpMyAdmin 5.2 will be/is PHP 8.1 compatible as it requires PHP 7.2 (#16555).

Hi @fabpot
Would you mind releasing a PHP 7.1 & PHP 8.1 compatible version of twig in the 3.x.x range with the fixes for PHP 8.1 ?

@williamdes
Copy link
Member Author

The last lib to be updated was released as https://github.com/code-lts/U2F-php-server/releases/tag/v1.2.0

williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Dec 12, 2021
…-server

Signed-off-by: William Desportes <williamdes@wdes.fr>
@linjialiang

This comment has been minimized.

@linjialiang
Copy link

php 8.0.13 no problem

williamdes added a commit that referenced this issue Dec 12, 2021
…f-php-server

Pull-request: #17241
Ref: #16746

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Dec 12, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
@silverqx
Copy link

@williamdes I have a very important observation, I tried to call composer update --prefer-dist --optimize-autoloader inside the phpMyAdmin folder to check if the latest dependencies could solve these warnings and guess what 🙂, any warnings anymore, everything works well.

@williamdes
Copy link
Member Author

@williamdes I have a very important observation, I tried to call composer update --prefer-dist --optimize-autoloader inside the phpMyAdmin folder to check if the latest dependencies could solve these warnings and guess what slightly_smiling_face, any warnings anymore, everything works well.

Sure, this is a good solution for users having composer. It will install a newer version of Twig depending on the PHP version used locally

Maybe we will have to patch Twig on the installed bundle, I doubt they will release a PHP 7.1 & PHP 8.1 compatible version

@fabpot
Copy link

fabpot commented Dec 13, 2021

@williamdes If that can help and if the diff is not too big, sure, we can probably re-add PHP 7.1 support for a "special" release. Anyone willing to investigate what that would mean?

@williamdes
Copy link
Member Author

@williamdes If that can help and if the diff is not too big, sure, we can probably re-add PHP 7.1 support for a "special" release. Anyone willing to investigate what that would mean?

Oh, that's a very kind response !
Seems like the two fixes to be picked would be:

If you know other fixes that could be nice, else I can investigate to find the PHP 8.1 fixes

@silverqx
Copy link

Ohh, they added php 8.1 support but dropped PHP 7.1 support, that is reason why you don't upgrade to latest twig? Why do we still need PHP 7.1 support? Latest Ubuntu LTS and even Debian Strech is packaged with PHP 7.4.

@williamdes
Copy link
Member Author

Ohh, they added php 8.1 support but dropped PHP 7.1 support, that is reason why you don't upgrade to latest twig? Why do we still need PHP 7.1 support? Latest Ubuntu LTS and even Debian Strech is packaged with PHP 7.4.

Yes, but @fabpot did bring us some light, so it's possible that we will be okay if they release a patch version with 7.1 compat

5.1 versions are committed to PHP 7.1 support, 5.2 versions will drop 7.1

On the Debian packaging side this will be different as it is like if you installed everything from composer but from .deb files. So it should stretch quite well between 7.1 and 8.1.That said I still have some debian packaging work

@stafred
Copy link

stafred commented Dec 22, 2021

you will need update your twig for php8.1 and change func strftime (deprecated) to date() or IntlDateFormatter:: . goog luck.

@williamdes
Copy link
Member Author

you will need update your twig for php8.1 and change func strftime (deprecated) to date() or IntlDateFormatter:: . goog luck.

We need Twig to release a version to continue PHP 7.1 compat and 8.1 compat for 5.1
@fabpot do you need some help ?

@NobodyButMe-Haiya
Copy link

@williamdes I have a very important observation, I tried to call composer update --prefer-dist --optimize-autoloader inside the phpMyAdmin folder to check if the latest dependencies could solve these warnings and guess what 🙂, any warnings anymore, everything works well.

still existed the bugs. we try in macos.

@williamdes
Copy link
Member Author

@williamdes I have a very important observation, I tried to call composer update --prefer-dist --optimize-autoloader inside the phpMyAdmin folder to check if the latest dependencies could solve these warnings and guess what slightly_smiling_face, any warnings anymore, everything works well.

still existed the bugs. we try in macos.

Did you try the latest 5.2 development version (phpMyAdmin 5.1+snapshot) ?
It is compatible and should work nicely, please report any bugs you find while using it

You can try the latest 5.1 version in development (phpMyAdmin 5.1+snapshot) but you will have to run composer update --prefer-dist --optimize-autoloader after extracting the version

@NobodyButMe-Haiya
Copy link

@williamdes I have a very important observation, I tried to call composer update --prefer-dist --optimize-autoloader inside the phpMyAdmin folder to check if the latest dependencies could solve these warnings and guess what slightly_smiling_face, any warnings anymore, everything works well.

still existed the bugs. we try in macos.

Did you try the latest 5.2 development version (phpMyAdmin 5.1+snapshot) ? It is compatible and should work nicely, please report any bugs you find while using it

You can try the latest 5.1 version in development (phpMyAdmin 5.1+snapshot) but you will have to run composer update --prefer-dist --optimize-autoloader after extracting the version

verify this is working sample no error with 5.2 development version

@williamdes
Copy link
Member Author

williamdes commented Jan 3, 2022

🎉 !
twigphp/Twig#3618

Twig 2.14.9 is now back to compatible with PHP 7.1 !!

And Twig 3.3.5 too !

Thank you so much @fabpot !

@williamdes williamdes added this to the 5.1.2 milestone Jan 3, 2022
@williamdes williamdes self-assigned this Jan 3, 2022
williamdes added a commit that referenced this issue Jan 3, 2022
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Jan 3, 2022
Closes: #16746

Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Reproduced to Closed Jan 3, 2022
@silverqx
Copy link

silverqx commented Jan 3, 2022

I test it later when there will be a snapshot @williamdes

@williamdes
Copy link
Member Author

I test it later when there will be a snapshot @williamdes

Right now ^^
Just re-built them

@silverqx
Copy link

silverqx commented Jan 3, 2022

I have tested it now and I'm not getting any deprecation warnings with the latest 5.1 snapshot anymore, thank you for fix @williamdes @fabpot ♥😁

@mhcwebdesign
Copy link

Now that this has been fixed, when can we expect a deb-package for Linux Mint 20.x or Ubuntu Focal?
Or does it already exist somewhere?

@williamdes
Copy link
Member Author

Now that this has been fixed, when can we expect a deb-package for Linux Mint 20.x or Ubuntu Focal? Or does it already exist somewhere?

Sure, please check out Wiki for install methods on Ubuntu/Debian
The latest version is available (5.1.3) and compatible with PHP 8.1

@mhcwebdesign
Copy link

Now that this has been fixed, when can we expect a deb-package for Linux Mint 20.x or Ubuntu Focal? Or does it already exist somewhere?

Sure, please check out Wiki for install methods on Ubuntu/Debian The latest version is available (5.1.3) and compatible with PHP 8.1

OK, thanks, good to know!

williamdes added a commit that referenced this issue Mar 5, 2022
…enDocument exports

Signed-off-by: William Desportes <williamdes@wdes.fr>
@ibennetch ibennetch unpinned this issue Mar 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature waiting on upstream Issues blocked by a third-party
Projects
issues
  
Closed
Development

No branches or pull requests

8 participants