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

Variables in Scanner #17

Open
EvilBozkurt opened this issue May 19, 2024 · 1 comment
Open

Variables in Scanner #17

EvilBozkurt opened this issue May 19, 2024 · 1 comment

Comments

@EvilBozkurt
Copy link

I can translate _($variable) this way with gettext and there are no errors. So far, no problem. But it causes this problem in the scanner. How can I prevent this? I am getting this error


<!--StartFragment-->
<b>Fatal error</b>:  Uncaught Exception: Invalid gettext function in Templates/default/header_breadcrumb.php:182. Some required arguments are not valid in C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\CodeScanner.php:148
--
  | Stack trace:
  | #0 C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\FunctionsHandlersTrait.php(15): Gettext\Scanner\CodeScanner-&gt;checkFunction(Object(Gettext\Scanner\ParsedFunction), 1)
  | #1 [internal function]: Gettext\Scanner\PhpScanner-&gt;gettext(Object(Gettext\Scanner\ParsedFunction))
  | #2 C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\CodeScanner.php(81): call_user_func(Array, Object(Gettext\Scanner\ParsedFunction))
  | #3 C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\CodeScanner.php(67): Gettext\Scanner\CodeScanner-&gt;handleFunction(Object(Gettext\Scanner\ParsedFunction))
  | #4 C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\Scanner.php(45): Gettext\Scanner\CodeScanner-&gt;scanString('&lt;!doctype html&gt;...', 'Templates/defau...')
  | #5 C:\xampp\htdocs\testpanel\Templates\default\admin\language.php(41): Gettext\Scanner\Scanner-&gt;scanFile('Templates/defau...')
  | #6 C:\xampp\htdocs\testpanel\index.php(2028): require('C:\\xampp\\htdocs...')
  | #7 C:\xampp\htdocs\testpanel\index.php(2857): {closure}()
  | #8 {main}
  | thrown in <b>C:\xampp\htdocs\testpanel\vendor\gettext\gettext\src\Scanner\CodeScanner.php</b> on line <b>148</b><br />

<!--EndFragment-->
@oscarotero
Copy link
Member

You can use the $scanner->ignoreInvalidFunctions() option to ignore them instead throw an exception.

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