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

Included lodash-php module dependency conflict when using composer autoloader. Breaks __() "trans" helper function. #452

Open
1 of 2 tasks
MattKunX opened this issue May 2, 2024 · 1 comment

Comments

@MattKunX
Copy link

MattKunX commented May 2, 2024

The bug
Due to the inclusion of the lodash-php module when using the composer autoloader, your module has the potential to be loaded before Laravel helper dependencies, which prevents the creation of Laravel's __() (trans) helper function. This results in all calls to __() breaking.

Essentially with this module as a dependency the Laravel project more than likely will need be manually installed in all other environments (dev, stage, prod, etc). Eliminating the ability to utilize composer install.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Laravel project with composer
  2. composer require northwestern-sysdev/dynamic-forms
  3. composer install (probably not necessary, just need "dynamic-forms" in the composer.json)
  4. Push (or copy w/o vendor/) the project to a clean environment (staging, etc)
  5. run composer install
  6. call the __('some text') function (in a view for example)
  7. load the page that calls the '__' helper function.

Expected behavior
The __() helper should not throw an exception and load as normal.

**Have you customized the resources/js/formio/defaults.js` file?

  • No
  • Yes (describe changes)

Additional context
In the Lodash module the '__' check if (!function_exists('__')) { on line 92 of Lodash.php is insufficient for preventing a conflict.

@tuursw
Copy link

tuursw commented May 21, 2024

Glad to have found this post, it is breaking my code and I was getting mad trying to find the reason why...

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