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

[BUG] validate-schema crash - Call to undefined function opcache_invalidate() #190

Closed
1 task
SierraKomodo opened this issue May 9, 2024 · 4 comments · Fixed by #192
Closed
1 task
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@SierraKomodo
Copy link

Describe the issue

Running validate-schema on a schema file crashes with the below error message. Error confirmed in various terminals (Nushell, cmd, powershell, git bash)

To Reproduce

  • Command you used: vendor\bin\csv-blueprint.bat validate-schema --schema=src/rimworld/inputcsv/available_crafting_apparel.yaml

available_crafting_apparel.csv

NOTE: Github apparently doesn't support uploading .yaml files, so I renamed it to .yaml.txt for uploading purposes
available_crafting_apparel.yaml.txt

PHP Fatal error:  Uncaught Error: Call to undefined function opcache_invalidate() in G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\AbstractValidate.php:144
Stack trace:
#0 G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\ValidateSchema.php(74): JBZoo\CsvBlueprint\Commands\AbstractValidate->findFiles('schema')
#1 G:\Projects\Tools\vendor\jbzoo\cli\src\CliCommand.php(159): JBZoo\CsvBlueprint\Commands\ValidateSchema->executeAction()
#2 G:\Projects\Tools\vendor\symfony\console\Command\Command.php(279): JBZoo\Cli\CliCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 G:\Projects\Tools\vendor\symfony\console\Application.php(1031): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 G:\Projects\Tools\vendor\symfony\console\Application.php(318): Symfony\Component\Console\Application->doRunCommand(Object(JBZoo\CsvBlueprint\Commands\ValidateSchema), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 G:\Projects\Tools\vendor\symfony\console\Application.php(169): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 G:\Projects\Tools\vendor\jbzoo\csv-blueprint\csv-blueprint.php(48): Symfony\Component\Console\Application->run()
#7 G:\Projects\Tools\vendor\jbzoo\csv-blueprint\csv-blueprint(18): require_once('G:\\Projects\\Too...')
#8 G:\Projects\Tools\vendor\bin\csv-blueprint(119): include('G:\\Projects\\Too...')
#9 {main}
  thrown in G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\AbstractValidate.php on line 144

Fatal error: Uncaught Error: Call to undefined function opcache_invalidate() in G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\AbstractValidate.php on line 144

Error: Call to undefined function opcache_invalidate() in G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\AbstractValidate.php on line 144

Call Stack:
    0.0003     863048   1. {main}() G:\Projects\Tools\vendor\bin\csv-blueprint:0
    0.0201    2424504   4. JBZoo\CsvBlueprint\CliApplication->run() G:\Projects\Tools\vendor\jbzoo\csv-blueprint\csv-blueprint.php:48
    0.0422    2884568   5. JBZoo\CsvBlueprint\CliApplication->doRun() G:\Projects\Tools\vendor\symfony\console\Application.php:169
    0.0427    2912896   6. JBZoo\CsvBlueprint\CliApplication->doRunCommand() G:\Projects\Tools\vendor\symfony\console\Application.php:318
    0.0428    2912896   7. JBZoo\CsvBlueprint\Commands\ValidateSchema->run() G:\Projects\Tools\vendor\symfony\console\Application.php:1031
    0.0429    2916640   8. JBZoo\CsvBlueprint\Commands\ValidateSchema->execute() G:\Projects\Tools\vendor\symfony\console\Command\Command.php:279
    0.0460    3125288   9. JBZoo\CsvBlueprint\Commands\ValidateSchema->executeAction() G:\Projects\Tools\vendor\jbzoo\cli\src\CliCommand.php:159
    0.0463    3125480  10. JBZoo\CsvBlueprint\Commands\ValidateSchema->findFiles() G:\Projects\Tools\vendor\jbzoo\csv-blueprint\src\Commands\ValidateSchema.php:74

Expected behavior

The validate-schema command should validate the schema file as described in the help text, instead of crashing.

Your environment

Question Answer
CSV Blueprint version 1.0.1
OS Windows 10
PHP 8.3.6
XDebug 3.3.2
Composer 2.7.6
Installation Method Composer

Any links to the CI logs or the repository, if any.

@SierraKomodo SierraKomodo added the bug Something isn't working label May 9, 2024
@SmetDenis
Copy link
Member

Hello.

opcache is a standard PHP module that is the default in all versions of the language. For some reason you have it disabled. It speeds up any your code dramatically.

Of course I will do an additional check for such an exclusive case. I would strongly recommend that you enable it. I assume you disabled it on your own or you have PHP specifically installed. It's very easy to do and another link. Even the very first line of the PHP documentation says so.

jbzoo_csv-blueprint 2024-05-09 11-44-45 PHP: Recommended Configuration on Windows systems - Manual 2024-05-09 11-44-20

@SmetDenis
Copy link
Member

Btw, I see you have XDebug enabled.
Just keep in mind that it also affects performance and slows down any PHP code a lot. If you don't need it, it's better to disable it. Just a friendly advice.

@SierraKomodo
Copy link
Author

That makes sense - Didn't realise that was a PHP extension. In that case, I recommend adding that extension as a requirement in the composer package.

As for XDebug, I only have it enabled when I'm developing and debugging things (I.e., when doing bug reports).

@SmetDenis SmetDenis added the enhancement New feature or request label May 9, 2024
@SmetDenis SmetDenis linked a pull request May 9, 2024 that will close this issue
@SmetDenis
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants