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

Deprecation errors in php 8 #3327

Closed
williamdes opened this issue May 13, 2020 · 16 comments
Closed

Deprecation errors in php 8 #3327

williamdes opened this issue May 13, 2020 · 16 comments

Comments

@williamdes
Copy link

williamdes commented May 13, 2020

Seems to be caused by https://php.watch/versions/8.0/deprecate-required-param-after-optional

Twig 2.x

https://travis-ci.org/github/phpmyadmin/phpmyadmin/jobs/686744942#L448

Errors

1) PhpMyAdmin\Tests\BrowseForeignersTest::testGetHtmlForRelationalFieldSelection
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $arguments follows optional parameter $callable") in "table/browse_foreigners/show_all.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/BrowseForeigners.php:176
test/classes/BrowseForeignersTest.php:206
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $arguments follows optional parameter $callable
vendor/twig/twig/src/Node/Expression/CallExpression.php:116
vendor/twig/twig/src/Node/Expression/TestExpression.php:17
vendor/twig/twig/src/ExpressionParser.php:693
vendor/twig/twig/src/ExpressionParser.php:79
vendor/twig/twig/src/TokenParser/IfTokenParser.php:36
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/BrowseForeigners.php:176
test/classes/BrowseForeignersTest.php:206
2) PhpMyAdmin\Tests\CentralColumnsTest::testGetHtmlForMain
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "database/central_columns/main.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/CentralColumns.php:1212
test/classes/CentralColumnsTest.php:652
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/CentralColumns.php:1212
test/classes/CentralColumnsTest.php:652
3) PhpMyAdmin\Tests\Config\FormDisplayTemplateTest::testDisplayTabsTop
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "list/unordered.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
test/classes/Config/FormDisplayTemplateTest.php:78
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
test/classes/Config/FormDisplayTemplateTest.php:78
4) PhpMyAdmin\Tests\Config\PageSettingsTest::testShowGroupBrowse
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "list/unordered.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
libraries/classes/Config/FormDisplay.php:336
libraries/classes/Config/PageSettings.php:168
libraries/classes/Config/PageSettings.php:87
libraries/classes/Config/PageSettings.php:206
test/classes/Config/PageSettingsTest.php:51
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
libraries/classes/Config/FormDisplay.php:336
libraries/classes/Config/PageSettings.php:168
libraries/classes/Config/PageSettings.php:87
libraries/classes/Config/PageSettings.php:206
test/classes/Config/PageSettingsTest.php:51
5) PhpMyAdmin\Tests\Config\PageSettingsTest::testGetNaviSettings
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "list/unordered.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
libraries/classes/Config/FormDisplay.php:336
libraries/classes/Config/PageSettings.php:168
libraries/classes/Config/PageSettings.php:87
libraries/classes/Config/PageSettings.php:222
test/classes/Config/PageSettingsTest.php:85
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Config/FormDisplayTemplate.php:105
libraries/classes/Config/FormDisplay.php:336
libraries/classes/Config/PageSettings.php:168
libraries/classes/Config/PageSettings.php:87
libraries/classes/Config/PageSettings.php:222
test/classes/Config/PageSettingsTest.php:85
6) PhpMyAdmin\Tests\Controllers\Database\StructureControllerTest::testDisplayTableList
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "database/structure/table_header.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/Database/StructureController.php:1131
test/classes/Controllers/Database/StructureControllerTest.php:592
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/Database/StructureController.php:1131
test/classes/Controllers/Database/StructureControllerTest.php:592
7) PhpMyAdmin\Tests\Controllers\Server\DatabasesControllerTest::testIndexAction
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "server/databases/index.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/AbstractController.php:45
libraries/classes/Controllers/Server/DatabasesController.php:178
test/classes/Controllers/Server/DatabasesControllerTest.php:67
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/AbstractController.php:45
libraries/classes/Controllers/Server/DatabasesController.php:178
test/classes/Controllers/Server/DatabasesControllerTest.php:67
8) PhpMyAdmin\Tests\Controllers\Server\VariablesControllerTest::testIndex
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "server/variables/index.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/AbstractController.php:45
libraries/classes/Controllers/Server/VariablesController.php:93
test/classes/Controllers/Server/VariablesControllerTest.php:92
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Controllers/AbstractController.php:45
libraries/classes/Controllers/Server/VariablesController.php:93
test/classes/Controllers/Server/VariablesControllerTest.php:92
9) PhpMyAdmin\Tests\Database\DesignerTest::testGetHtmlForEditOrDeletePages
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "database/designer/edit_delete_pages.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Database/Designer.php:67
test/classes/Database/DesignerTest.php:137
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Database/Designer.php:67
test/classes/Database/DesignerTest.php:137
10) PhpMyAdmin\Tests\Database\DesignerTest::testGetHtmlForPageSaveAs
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "database/designer/page_save_as.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Database/Designer.php:85
test/classes/Database/DesignerTest.php:166
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Database/Designer.php:85
test/classes/Database/DesignerTest.php:166
11) PhpMyAdmin\Tests\Display\ExportTest::testGetHtmlForOptions
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "display/export/options_format.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Display/Export.php:256
libraries/classes/Display/Export.php:566
test/classes/Display/ExportTest.php:145
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Display/Export.php:256
libraries/classes/Display/Export.php:566
test/classes/Display/ExportTest.php:145
12) PhpMyAdmin\Tests\HeaderTest::testEnable
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "console/display.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Console.php:137
libraries/classes/Header.php:446
test/classes/HeaderTest.php:71
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Console.php:137
libraries/classes/Header.php:446
test/classes/HeaderTest.php:71
13) PhpMyAdmin\Tests\HeaderTest::testSetBodyId
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "console/display.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Console.php:137
libraries/classes/Header.php:446
test/classes/HeaderTest.php:86
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Console.php:137
libraries/classes/Header.php:446
test/classes/HeaderTest.php:86
14) PhpMyAdmin\Tests\NormalizationTest::testGetHtmlForCreateNewColumn
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "columns_definitions/table_fields_definitions.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Normalization.php:202
test/classes/NormalizationTest.php:150
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Normalization.php:202
test/classes/NormalizationTest.php:150
15) PhpMyAdmin\Tests\RelationTest::testPMAGetRelationsParam
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "list/unordered.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Relation.php:426
test/classes/RelationTest.php:103
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/ForTokenParser.php:52
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Relation.php:426
test/classes/RelationTest.php:103
16) PhpMyAdmin\Tests\SqlQueryFormTest::testPMAGetHtmlForSqlQueryFormInsert
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "sql/query.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/SqlQueryForm.php:127
test/classes/SqlQueryFormTest.php:110
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/SqlQueryForm.php:127
test/classes/SqlQueryFormTest.php:110
17) PhpMyAdmin\Tests\SqlQueryFormTest::testPMAGetHtmlForSqlQueryForm
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "sql/query.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/SqlQueryForm.php:127
test/classes/SqlQueryFormTest.php:175
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/SqlQueryForm.php:127
test/classes/SqlQueryFormTest.php:175
18) PhpMyAdmin\Tests\TrackingTest::testGetHtmlForMain
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "table/tracking/main.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Tracking.php:189
test/classes/TrackingTest.php:214
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Tracking.php:189
test/classes/TrackingTest.php:214
19) PhpMyAdmin\Tests\TwoFactorTest::testKey
Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("Required parameter $lineno follows optional parameter $only") in "login/twofactor/key.twig".
vendor/twig/twig/src/Environment.php:600
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Plugins/TwoFactor/Key.php:128
libraries/classes/TwoFactor.php:218
test/classes/TwoFactorTest.php:205
Caused by
PHPUnit\Framework\Error\Deprecated: Required parameter $lineno follows optional parameter $only
vendor/twig/twig/src/Node/IncludeNode.php:25
vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:33
vendor/twig/twig/src/Parser.php:185
vendor/twig/twig/src/Parser.php:98
vendor/twig/twig/src/Environment.php:563
vendor/twig/twig/src/Environment.php:595
vendor/twig/twig/src/Environment.php:408
vendor/twig/twig/src/Environment.php:381
vendor/twig/twig/src/Environment.php:359
libraries/classes/Template.php:101
libraries/classes/Template.php:134
libraries/classes/Plugins/TwoFactor/Key.php:128
libraries/classes/TwoFactor.php:218
test/classes/TwoFactorTest.php:205

@williamdes
Copy link
Author

@fabpot I think this line of code illustrates this issue
(lineno is not optional, but the following is)

public function __construct(string $name, int $index, AbstractExpression $variables = null, bool $only = false, bool $ignoreMissing = false, int $lineno, string $tag = null)

@williamdes
Copy link
Author

@ondrejmirtes Does phpstan cover this case for php 8 ? (I think not 🤔 )

@nicolas-grekas
Copy link
Contributor

Would you mind sending a PR to fix this please?

@williamdes
Copy link
Author

Should I start on a particular branch ?

@nicolas-grekas
Copy link
Contributor

The fix is to use nullable types instead of null defaults. Since this syntax requires PHP 7.1 minimum, only branch 3.x is eligible.

Please check the full source for similar cases. Thanks!

@williamdes
Copy link
Author

Just adding = null to parameters between optional ones could be a better solution for 2.x, right?

@stof
Copy link
Member

stof commented May 14, 2020

The thing is, first parameters are not optional right now. The = null is there to make the nullable.
Making more params optional and nullable will actually change the signature (and break some things as it will now allow null in places not supporting it).

@williamdes
Copy link
Author

The thing is, first parameters are not optional right now. The = null is there to make the nullable.
Making more params optional and nullable will actually change the signature (and break some things as it will now allow null in places not supporting it).

I understand, I think we will need to mark phpMyAdmin as not supporting php 8 at some time because of this.
cc @MauricioFauth

I will do a PR for 3.x ASAP

@nicolas-grekas
Copy link
Contributor

nicolas-grekas commented May 14, 2020

mark phpMyAdmin as not supporting php 8 at some time because of this

you could also ignore the deprecation using a custom error handler

@williamdes
Copy link
Author

mark phpMyAdmin as not supporting php 8 at some time because of this

you could also ignore the deprecation using a custom error handler

Sure, this is a better idea

@stof
Copy link
Member

stof commented May 14, 2020

I understand, I think we will need to mark phpMyAdmin as not supporting php 8 at some time because of this.

Or you could migrate to Twig 3.x

@williamdes
Copy link
Author

I understand, I think we will need to mark phpMyAdmin as not supporting php 8 at some time because of this.

Or you could migrate to Twig 3.x

If we can have compatibility on 2.x or 3.x without major changes we will allow 3.x to be used if available. If it is not possible we will only migrate to twig 3.x on the development version.

Anyway this is only a question to bring more php support to users or not. (This decision will have long term consequences on our Debian packaging)
https://www.phpmyadmin.net/downloads/#support

you could also ignore the deprecation using a custom error handler

For now, this solution is the best one.
If the errors can be removed then it will be the solution implemented on our 5.x series and if 3.x can be used without breaking changes we will allow 3.x on out 5.x series.

I know, this seems over complicated but I am very serious about the packaging teams having some difficulties or not to package the next version :)

@stof
Copy link
Member

stof commented May 14, 2020

If we can have compatibility on 2.x or 3.x without major changes we will allow 3.x to be used if available.

Supporting both is entirely possible, assuming you don't use any deprecated feature in 2.x (as they are gone in 3.0). Symfony does exactly that.

@williamdes
Copy link
Author

docker run -it -v $(pwd):/mnt/Dev/ devilbox/php-fpm-8.0:latest bash

Tests output

root@ea8a9376f0b4:/mnt/Dev# ~/.composer/vendor/bin/phpunit 
PHPUnit 9.1.4 by Sebastian Bergmann and contributors.

Testing 
..WFFW..WWWWWWS.........................F....................   61 / 1609 (  3%)
.............................................................  122 / 1609 (  7%)
.............................................................  183 / 1609 ( 11%)
.............................................................  244 / 1609 ( 15%)
.............................................................  305 / 1609 ( 18%)
.............................................................  366 / 1609 ( 22%)
.............................................................  427 / 1609 ( 26%)
.............................................................  488 / 1609 ( 30%)
.............................................................  549 / 1609 ( 34%)
.............................E......FCompiled templates that failed on case 1:
Template: index.twig
<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* index.twig */
class __TwigTemplate_1b56cfccd8867f3f1b06032968c57b45661d3b8d3c879cb5f38ab583c75ec092_b58d1d5fcb6a585376d6b2bfd85f306ad68a20823b9ad27fb331de2615a9848d extends Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
        $this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
        $tags = array("for" => 5);
        $filters = array("escape" => 2);
        $functions = array();

        try {
            $this->sandbox->checkSecurity(
                ['for'],
                ['escape'],
                []
            );
        } catch (SecurityError $e) {
            $e->setSourceContext($this->source);

            if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
                $e->setTemplateLine($tags[$e->getTagName()]);
            } elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
                $e->setTemplateLine($filters[$e->getFilterName()]);
            } elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
                $e->setTemplateLine($functions[$e->getFunctionName()]);
            }

            throw $e;
        }

    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "
Hello '";
        // line 2
        echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["images"]) || array_key_exists("images", $context) ? $context["images"] : (function () { throw new RuntimeError('Variable "images" does not exist.', 2, $this->source); })()), "image", [], "any", false, false, true, 2), 0, [], "any", false, false, true, 2), "group", [], "any", false, false, true, 2), 2, $this->source), "html", null, true);
        echo "'!
";
        // line 3
        echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["images"]) || array_key_exists("images", $context) ? $context["images"] : (function () { throw new RuntimeError('Variable "images" does not exist.', 3, $this->source); })()), "image", [], "any", false, false, true, 3), 0, [], "any", false, false, true, 3), "group", [], "any", false, false, true, 3), "attributes", [], "any", false, false, true, 3), "myattr", [], "any", false, false, true, 3), 3, $this->source), "html", null, true);
        echo "
";
        // line 4
        echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["images"]) || array_key_exists("images", $context) ? $context["images"] : (function () { throw new RuntimeError('Variable "images" does not exist.', 4, $this->source); })()), "children", [], "method", false, false, true, 4), "image", [], "any", false, false, true, 4), "count", [], "method", false, false, true, 4), 4, $this->source), "html", null, true);
        echo "
";
        // line 5
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable((isset($context["images"]) || array_key_exists("images", $context) ? $context["images"] : (function () { throw new RuntimeError('Variable "images" does not exist.', 5, $this->source); })()));
        foreach ($context['_seq'] as $context["_key"] => $context["image"]) {
            // line 6
            echo "    - ";
            echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["image"], "group", [], "any", false, false, true, 6), 6, $this->source), "html", null, true);
            echo "
";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['image'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
    }

    public function getTemplateName()
    {
        return "index.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  81 => 6,  77 => 5,  73 => 4,  69 => 3,  65 => 2,  62 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "index.twig", "");
    }
}
........................  610 / 1609 ( 37%)
.............................................................  671 / 1609 ( 41%)
...............................F...FF........................  732 / 1609 ( 45%)
.............................................................  793 / 1609 ( 49%)
.............................................................  854 / 1609 ( 53%)
.............................................................  915 / 1609 ( 56%)
.............................................................  976 / 1609 ( 60%)
............................................................. 1037 / 1609 ( 64%)
............................................................. 1098 / 1609 ( 68%)
............................................................. 1159 / 1609 ( 72%)
............................................................. 1220 / 1609 ( 75%)
............................................................. 1281 / 1609 ( 79%)
............................................................. 1342 / 1609 ( 83%)
............................................................. 1403 / 1609 ( 87%)
............................................................. 1464 / 1609 ( 90%)
............................................................. 1525 / 1609 ( 94%)
............................................................. 1586 / 1609 ( 98%)
.......................                                       1609 / 1609 (100%)

Time: 00:01.170, Memory: 34.00 MB

There was 1 error:

1) Twig\Tests\IntegrationTest::testIntegration with data set #326 ('tests/in.test', 'Twig supports the in operator', '', array('\n{{ bar in foo ? 'OK' : 'KO'...OK' }}'), false, array(array('--DATA--\nreturn ['bar' => 'b...OK\nOK', '\nreturn ['bar' => 'bar', 'fo...8')]\n', '', '\nOK\nOK\nOK\nOK\nOK\nOK\nOK\...OK\nOK')), '')
TypeError: Unsupported operand types: resource + int

/mnt/Dev/src/Template.php:396
/mnt/Dev/src/Template.php:369
/mnt/Dev/src/Template.php:381
/mnt/Dev/src/TemplateWrapper.php:40
/mnt/Dev/src/Test/IntegrationTestCase.php:222
/mnt/Dev/src/Test/IntegrationTestCase.php:82

--

There were 8 warnings:

1) Twig\Tests\Cache\FilesystemTest::testWrite
assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.

2) Twig\Tests\Cache\FilesystemTest::testWriteFailWriteFile
assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.

3) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #0 ('#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', 'a/b')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

4) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #1 ('#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', 'a/b/')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

5) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #2 ('#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', 'a/b\')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

6) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #3 ('#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', 'a/b\/')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

7) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #4 ('#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', 'a/b\//')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

8) Twig\Tests\Cache\FilesystemTest::testGenerateKey with data set #5 ('#/a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#', '/a/b')
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

--

There were 7 failures:

1) Twig\Tests\Cache\FilesystemTest::testWriteFailMkdir
Failed asserting that exception of type "RuntimeException" is thrown.

2) Twig\Tests\Cache\FilesystemTest::testWriteFailDirWritable
Failed asserting that exception of type "RuntimeException" is thrown.

3) Twig\Tests\ErrorTest::testDoesNotTwigLeakOutput
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Deprecated: Required parameter $arguments follows optional parameter $callable in /mnt/Dev/src/Node/Expression/CallExpression.php on line 115'

/mnt/Dev/tests/ErrorTest.php:218

4) Twig\Tests\IntegrationTest::testIntegration with data set #333 ('regression/simple_xml_element.test', 'Twig is able to deal with Sim...iables', '', array('\nHello '{{ images.image.0.gr...for %}'), false, array(array('--DATA--\nreturn ['images' =>... - bar', '\nreturn ['images' => new \Si...>')]\n', '', '\nHello 'foo'!\nexample\n2\n ... - bar')), '')
Twig is able to deal with SimpleXMLElement instances as variables (in regression/simple_xml_element.test)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Hello 'foo'!\n
-example\n
-2\n
-    - foo\n
-    - bar'
+'Twig\Error\Error: Twig\Error\RuntimeError: Neither the property "0" nor one of the methods "0()", "get0()"/"is0()"/"has0()" or "__call()" exist and have public access in class "SimpleXMLElement" in "index.twig" at line 2.'

/mnt/Dev/src/Test/IntegrationTestCase.php:251
/mnt/Dev/src/Test/IntegrationTestCase.php:82

5) Twig\Tests\Node\Expression\CallTest::testResolveArgumentsWithMissingValueForOptionalArgument
Failed asserting that exception message 'Unknown argument "case_sensitivity" for function "substr_compare(main_str, str, offset, length, case_insensitivity)".' contains 'Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length".'.

6) Twig\Tests\Node\Expression\CallTest::testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction
Failed asserting that exception of type "Error" matches expected exception "LogicException". Message was: "Call to undefined method Twig\Tests\Node\Expression\CallTest::expectExceptionMessageRegExp()" at
/mnt/Dev/tests/Node/Expression/CallTest.php:116
.

7) Twig\Tests\Node\Expression\CallTest::testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject
Failed asserting that exception of type "Error" matches expected exception "LogicException". Message was: "Call to undefined method Twig\Tests\Node\Expression\CallTest::expectExceptionMessageRegExp()" at
/mnt/Dev/tests/Node/Expression/CallTest.php:125
.

ERRORS!
Tests: 1609, Assertions: 4285, Errors: 1, Failures: 7, Warnings: 8, Skipped: 1.

Unsilenced deprecation notices (25)

  16x: Method ReflectionParameter::isArray() is deprecated
    4x in IntegrationTest::testIntegration from Twig\Tests
    4x in FilterTest::testCompile from Twig\Tests\Node\Expression
    4x in FunctionTest::testCompile from Twig\Tests\Node\Expression
    4x in TestTest::testCompile from Twig\Tests\Node\Expression

  3x: Required parameter $lineno follows optional parameter $only
    2x in IntegrationTest::testIntegration from Twig\Tests
    1x in IncludeTest::getTests from Twig\Tests\Node

  1x: Required parameter $arguments follows optional parameter $callable
    1x in DeprecatedTest::getTests from Twig\Tests\Node

  1x: Required parameter $body follows optional parameter $ifexpr
    1x in ForTest::getTests from Twig\Tests\Node

  1x: Required parameter $lineno follows optional parameter $ifexpr
    1x in ForTest::getTests from Twig\Tests\Node

  1x: The "index.twig" template is deprecated, use "greeting.twig" instead. ("index.twig" at line 4).
    1x in IntegrationTest::testLegacyIntegration from Twig\Tests

  1x: The "welcome" macro is deprecated, use "hello" instead. ("greeting.twig" at line 3).
    1x in IntegrationTest::testLegacyIntegration from Twig\Tests

  1x: The "welcome" block is deprecated, use "hello" instead. ("greeting.twig" at line 3).
    1x in IntegrationTest::testLegacyIntegration from Twig\Tests

Other deprecation notices (1)

  1x: Required parameter $arguments follows optional parameter $callable



@williamdes
Copy link
Author

TypeError: Unsupported operand types: resource + int

What should I change ?

{{ resource in [resource + 1 - 1] ? 'KO' : 'OK' }}

@williamdes
Copy link
Author

Fixed by #3331

williamdes added a commit to phpmyadmin/phpmyadmin that referenced this issue May 28, 2020
Ref: twigphp/Twig#3327
Upstream: twigphp/Twig#3331

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit to phpmyadmin/twig-i18n-extension that referenced this issue Jun 13, 2020
Ref: twigphp/Twig#3331
Ref: twigphp/Twig#3327

Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants