Skip to content

fix: add undefined check for expr in parseItem function #210

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ShawnAtActivate
Copy link

@ShawnAtActivate ShawnAtActivate commented May 22, 2025

This isn't a "bug" with the code but rather uncovered by bad / unsupported functionality when using laravels __ function in unintended ways

  • Prevents errors when expr is null or undefined allowing build to succeed.
  • Follow same path as if expr is null

image

@ShawnAtActivate
Copy link
Author

I did some further digging in to what causes this bug. It's due to a php lang file on my end trying to make a laravel localization call to another localization file

<?php

return array(
  'test' => __('anotherfile')
);

The crash happens when trying to parseItem(expr.value) if value is not set of undefined because of bad data resulting in an undefined type and the build error displayed in the PR
image

image

TL;DR

  • Tried to nest lang translations using __
  • Found crash where parseItem checks for .value on a callback function that doesnt exist resulting in undefined being passed
  • Boom

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

Successfully merging this pull request may close these issues.

1 participant