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

Syntax error in Factory/Localization.php #53

Closed
PRodO5lNk5 opened this issue Feb 28, 2017 · 6 comments
Closed

Syntax error in Factory/Localization.php #53

PRodO5lNk5 opened this issue Feb 28, 2017 · 6 comments
Milestone

Comments

@PRodO5lNk5
Copy link

PRodO5lNk5 commented Feb 28, 2017

Hi, I'm using Laravel v5.2.45, it could be I'm missing something, basically I followed the installation instructions and when I try to run any of the localization commands I get this error
syntax error, unexpected ';', expecting ',' or ')' in /var/www/html/local.familiando/vendor/potsky/laravel-localization-helpers/src/Potsky/LaravelLocalizationHelpers/Factory/Localization.php(323) : eval()'d code on line 1

@potsky
Copy link
Owner

potsky commented Feb 28, 2017

Hello !

Could you modify the line 323 of file /var/www/html/local.familiando/vendor/potsky/laravel-localization-helpers/src/Potsky/LaravelLocalizationHelpers/Factory/Localization.php, change :

					$real_value           = eval( "return $k;" );

by

error_log( $k );
					$real_value           = eval( "return $k;" );

and send me the output ?

@potsky
Copy link
Owner

potsky commented Mar 1, 2017

@ocdC0d3r,

I tried a lot of thing and I cannot reproduce this bug. I am really impatient to see which lemma can cause this problem!

@PRodO5lNk5
Copy link
Author

PRodO5lNk5 commented Mar 1, 2017

Sorry it took me this long, the output now apparently gives the proper result followed with the same error

Also, I've used the v2.3.* instalation of the package

Here's the output:

'widgets/pendingInvitations.invitations.pending' 'widgets/pendingInvitations.view.details' 'widgets/members.content.title' 'widgets/members.content.details' 'widgets/membersInStructure.content.title' 'widgets/membersInStructure.content.view' 'widgets/membersInFirstRow.content.title' 'widgets/membersInFirstRow.content.view' 'widgets/offers.view.count' 'widgets/offers.view.details' 'widgets/articles.view.count' 'widgets/articles.view.details' 'widgets/provisions.content.title' 'widgets/provisions.content.table.head.id' 'widgets/provisions.content.table.head.created' 'widgets/provisions.content.table.head.currency' 'widgets/provisions.content.table.head.amount' 'widgets/provisions.content.table.empty' 'widgets/provisions.content.table.empty.link' 'widgets/comments.view.count' 'widgets/comments.view.details' 'auth/register.panel.personalInfo.title' 'auth/register.form.person.label.firstname' 'auth/register.form.person.placeholder.firstname' 'auth/register.form.person.label.lastname' 'auth/register.form.person.placeholder.lastname' 'auth/register.form.person.label.companyName' 'auth/register.form.person.label.email' 'auth/register.form.person.label.password' 'auth/register.form.person.placeholder.password' 'auth/register.form.person.label.confirmPassword' 'auth/register.form.person.placeholder.confirmPassword' 'auth/register.form.button.register' 'auth/register.form.button.cancel' 'auth/register.panel.personalInfo.title' 'auth/register.form.person.label.firstname' 'auth/register.form.person.placeholder.firstname' 'auth/register.form.person.label.lastname' 'auth/register.form.person.placeholder.lastname' 'auth/register.form.person.label.companyName' 'auth/register.form.person.placeholder.companyName' 'auth/register.form.person.label.email' 'auth/register.form.person.label.password' 'auth/register.form.person.placeholder.password' 'auth/register.form.person.label.confirmPassword' 'auth/register.form.person.placeholder.confirmPassword' 'auth/register.form.checkbox.terms' 'auth/register.form.button.register' 'auth/register.form.button.cancel' 'auth/register.form.person.label.email' 'auth/register.form.person.placeholder.email' 'emails/offersApprove.text.title' 'emails/offersApprove.text.content' 'emails/paymentRemainder.text.title' 'emails/applicationDecline.text.title' 'emails/applicationDecline.text.content' 'emails/memberCardRemainder.text.title' 'emails/memberCardRemainder.text.content.last' 'emails/application.text.title' 'emails/application.text.content' 'emails/expiringOffers.content.title' 'emails/expiringOffers.content.message' 'emails/expiringOffers.content.offer.url' 'emails/invitation.text.title' 'emails/invitation.text.title.part.1' 'emails/invitation.text.title.part.2' 'emails/invitation.text.title.part.3' 'emails/invitation.text.title.part.4' 'emails/invitation.text.title.part.5' 'auth/emails/password.content.reset.link' 'auth/emails/password.content.reset.title' 'auth/emails/password.content.reset.ignore' 'emails/pdf-letters.content.message.title' 'emails/pdf-letters.content.message.cards' 'emails/pdf-letters.content.message.letters' 'emails/contact-familiando.text.title' 'emails/offers.text.title' 'emails/offers.text.content' 'emails/contact.text.title' 'emails/contact.text.title.name' 'emails/contact.text.title.email' 'emails/contact.text.title.message' 'emails/memberCardRemainder.text.title' 'emails/memberCardRemainder.text.content' 'emails/newPartnerApplication.text.title' 'emails/newPartnerApplication.text.content' 'emails/newPartnerApplication.text.description' 'emails/newPartnerApplication.text.companyName' 'emails/newPartnerApplicationASVM.text.title' 'emails/newPartnerApplicationASVM.text.content' 'emails/pdf-letters.content.message.noRequests' 'emails/notificationForLiteMembers.email.title' 'emails/notificationForLiteMembers.email.description' 'auth/login.form.title.login' 'auth/login.form.input.label.email' 'auth/login.form.input.label.password' 'auth/login.form.input.label.remember' 'auth/login.form.button.login' 'auth/login.form.button.cancel' 'auth/login.form.button.forgot' 'pages/members/familyMembers.page.head.title' 'pages/members/familyMembers.form.head.title' 'pages/members/familyMembers.form.fmType' 'pages/members/familyMembers.form.type.placeholder' 'pages/members/familyMembers.form.title' 'pages/members/familyMembers.form.title.placeholder' 'pages/members/familyMembers.form.firstname' 'pages/members/familyMembers.form.lastname' 'pages/members/familyMembers.form.dateOfBirth' 'pages/members/familyMembers.form.email' 'pages/members/familyMembers.form.mobile' 'pages/members/familyMembers.form.add' 'pages/members/familyMembers.table.content.heading' 'pages/members/familyMembers.table.head.title.type' 'pages/members/familyMembers.table.head.title.firstname' 'pages/members/familyMembers.table.head.title.lastname' 'pages/members/familyMembers.table.head.title.dob' 'pages/members/familyMembers.table.head.title.email' 'pages/members/familyMembers.table.head.title.mobile' 'pages/members/familyMembers.table.content.empty' 'payment/success.content.message.disable' 'payment/success.content.message.confirm' 'payment/success.button.confirm' 'payment/success.content.message.success' 'payment/success.button.login' 'payment/payment.content.title' 'payment/payment.content.form.email' 'payment/payment.content.form.amount' 'payment/payment.content.form.currency' 'payment/payment.content.form.send' 'payment/cancel.content.message' 'payment/cancel.content.title' 'payment/cancel.button.restart' 'errors/404.content.title' 'errors/404.content.title' 'errors/404.content.desc' 'errors/503.content.title' 'pages/members/articles.form.image.modal.minHeightImageError' 'pages/members/articles.form.image.modal.minWidthImageError' 'pages/members/articles.form.image.modal.typeError' 'pages/members/articles.form.image.modal.loading' 'pages/members/articles.form.image.modal.sizeLimit' 'pages/members/articles.form.image.action.crop' 'pages/members/articles.form.image.modal.description' 'pages/members/articles.form.image.modal.button' 'pages/members/articles.form.image.modal.dropImage' 'pages/members/articles.form.image.modal.processing' 'pages/members/articles.form.image.modal.retry' 'pages/members/articles.form.image.modal.clickToUploadImage' 'pages/members/articles.form.image.modal.close' 'pages/presentation/partners.content.title' 'master' 'pages/presentation/article.mostRead.count' 'pages/presentation/parentCategoryArticles.content.articles.most.commented' 'master' 'includes/presentation/aside.register.title' 'includes/presentation/aside.register.button' 'includes/presentation/aside.newsletter.description' 'includes/presentation/aside.newsletter.form.email.placeholder' 'includes/presentation/aside.newsletter.form.email.button' 'includes/presentation/aside.tag.cloud.title' 'auth/login.form.title.login' 'auth/login.form.input.label.remember' 'payment/success.button.login' 'auth/login.form.button.forgot' 'auth/register.form.register.new' 'auth/register.form.person.label.firstname' 'auth/register.form.person.label.lastname' 'auth/register.form.person.label.email' 'auth/login.form.input.label.password' 'auth/register.form.person.label.confirmPassword' 'auth/register.form.checkbox.terms' 'auth/register.form.checkbox.membership' 'auth/register.form.button.register' 'auth/login.form.title.hasAccount' 'errors/popupForm.content.error' 'errors/popupForm.content.warning' 'pages/master/home.offers.message.' . session('message' PHP ParseError: syntax error, unexpected ';', expecting ',' or ')' in /var/www/html/local.familiando/vendor/potsky/laravel-localization-helpers/src/Potsky/LaravelLocalizationHelpers/Factory/Localization.php(324) : eval()'d code on line 1 PHP Stack trace: PHP 1. {main}() /var/www/html/local.familiando/artisan:0 PHP 2. Illuminate\Foundation\Console\Kernel->handle() /var/www/html/local.familiando/artisan:35 PHP 3. Symfony\Component\Console\Application->run() /var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107 PHP 4. Symfony\Component\Console\Application->doRun() /var/www/html/local.familiando/vendor/symfony/console/Application.php:117 PHP 5. Symfony\Component\Console\Application->doRunCommand() /var/www/html/local.familiando/vendor/symfony/console/Application.php:186 PHP 6. Illuminate\Console\Command->run() /var/www/html/local.familiando/vendor/symfony/console/Application.php:794 PHP 7. Symfony\Component\Console\Command\Command->run() /var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Console/Command.php:155 PHP 8. Illuminate\Console\Command->execute() /var/www/html/local.familiando/vendor/symfony/console/Command/Command.php:256 PHP 9. Illuminate\Container\Container->call() /var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Console/Command.php:169 PHP 10. call_user_func_array:{/var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Container/Container.php:507 PHP 11. Potsky\LaravelLocalizationHelpers\Command\LocalizationMissing->fire() /var/www/html/local.familiando/vendor/laravel/framework/src/Illuminate/Container/Container.php:507 PHP 12. Potsky\LaravelLocalizationHelpers\Factory\Localization->extractTranslationsFromFolders() /var/www/html/local.familiando/vendor/potsky/laravel-localization-helpers/src/Potsky/LaravelLocalizationHelpers/Command/LocalizationMissing.php:151

@PRodO5lNk5
Copy link
Author

Ah as I'm looking through the log I've noticed I have this blade directive
@lang('pages/master/home.offers.message.' . session('message'))
which might be causing the problem

@potsky
Copy link
Owner

potsky commented Mar 1, 2017

Ouch !

The problem is this dynamic field indeed. You should ignore it. The extension cannot guess what could be the value of session('message'). You should rename your dynamic fields like this :

@lang('pages/master/home.offers.dynamic.message.' . session("message"))
  1. The extension will ignore this because there is a new key named dynamic. You can change this value in the configuration file in the 'never_obsolete_keys' section.
  2. And the code will not crash now because you have used simple quotes to define the lemma key and double quotes to inject the dynamic value.

I will add a fix to ignore the second point.

@PRodO5lNk5
Copy link
Author

Indeed, the main problem are those dynamic fields with concatenation. There are only few places in my code where this case occurs, shouldn't be a problem fix it on my end.

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