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

Check for deprecation warning #6

Merged
merged 2 commits into from
Oct 9, 2023
Merged

Check for deprecation warning #6

merged 2 commits into from
Oct 9, 2023

Conversation

Baspa
Copy link
Contributor

@Baspa Baspa commented Sep 28, 2023

I was just trying to parse mjml to html but I got the following error message:

In Mjml.php line 143:

array_key_exists(): Argument #2 ($array) must be of type array, null given

Then I checked the $resultString in the mjml.php and it seems I received the following data when I dump the $resultString:

MJML v3 syntax detected, migrating to MJML v4 syntax. Use mjml -m to get the migrated MJML. {"mjmlError":"TypeError: Cannot read properties of undefined (reading 'tagName')"}

This causes the code not being able to parse the result to json. I added a check to see if the resultString contains the deprecation warning. This code can probably be improved but it works for now. Please let me know if I can do anything to improve this PR. I can try to add tests for example.

@freekmurze
Copy link
Member

Thanks! Could you indeed add a test for this?

@Baspa
Copy link
Contributor Author

Baspa commented Oct 9, 2023

@freekmurze I've added a test which uses both valid and deprecated mjml. Please let me know if this is sufficient or if more tests and/or code changes are needed.

@freekmurze freekmurze merged commit 61f1b05 into spatie:main Oct 9, 2023
9 checks passed
@freekmurze
Copy link
Member

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

Successfully merging this pull request may close these issues.

2 participants