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

Validate command fails on PHP 8 #98

Closed
marinaglancy opened this issue May 12, 2021 · 4 comments
Closed

Validate command fails on PHP 8 #98

marinaglancy opened this issue May 12, 2021 · 4 comments

Comments

@marinaglancy
Copy link
Member

We have a strange failure for the validate command on one of workplace plugins (in gitlab CI):

$ . check moodle-plugin-ci validate
 RUN  Validating tool_dynamicrule
Warning: Undefined array key 312 in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 258
Warning: Undefined array key "" in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 190
Warning: Undefined array key "" in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 359
Warning: Undefined array key 312 in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 258
Warning: Undefined array key "" in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 190
Warning: Undefined array key "" in /var/www/html/ci/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 359
> Found required file: version.php
> Found required file: lang/en/tool_dynamicrule.php
X Failed to parse /builds/workplace/moodle/admin/tool/dynamicrule/db/upgrade.php file due to parse error: Syntax error, unexpected  on line 85
> In lang/en/tool_dynamicrule.php, found language pluginname
> In db/install.xml, found table prefixes tool_dynamicrule
....

The rest of the log is fine.

The line 85 in admin/tool/dynamicrule/db/upgrade.php is:

        \tool_tenant\manager::create_workplace_role('tool_dynamicrule_manager',

There is nothing wrong with this line, it's the beginning of the function call spread over several lines.

The same plugin does not produce any errors on PHP 7

@marinaglancy
Copy link
Member Author

marinaglancy commented May 12, 2021

I reproduced it on the open-source repo in GHA:

there it complains about the line

$handler = tool_certificate\customfield\issue_handler::create();

I can see some pattern here...

branch: https://github.com/marinaglancy/moodle-mod_coursecertificate/tree/test311
GHA log: https://github.com/marinaglancy/moodle-mod_coursecertificate/runs/2566383396?check_suite_focus=true

It also fails on phpdocs command but afaik it was already fixed in moodlehq/moodle-local_moodlecheck#72 , just not tagged yet

@marinaglancy
Copy link
Member Author

marinaglancy commented May 12, 2021

@stronk7
Copy link
Member

stronk7 commented May 12, 2021

Hi @marinaglancy ,

maybe, once #99 is reviewed and, hopefully lands... you can try with your plugin pointing to dev-master (instead of ^3). That way it will use the latest code that comes with an update of the php-parser from versions 3.x to 4.x (that in theory supports php80).

Let's see...

@marinaglancy
Copy link
Member Author

yes, confirming that #99 fixed it! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants