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

Mitigate T_ENCAPSED_AND_WHITESPACE bug #399

Merged
merged 2 commits into from
Feb 10, 2021

Conversation

iclukas
Copy link
Contributor

@iclukas iclukas commented Feb 10, 2021

We recently ran into some trouble because of the slightly obscure and still unfixed T_ENCAPSED_AND_WHITESPACE bug in PHP. It has to do with string parts looking like variables.

First of all, the include() should be protected by a try/catch block. This works in PHP 7 and PHP 5 will just ignore the catch block.
Second, arrays and resources don’t need serialize(), they can be enoded with var_export() which returns native PHP code. Obviously, this will decode faster and is not prone to the forementioned bug.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 84.737% when pulling 42723e2 on iclukas:Mitigate_T_ENCAPSED_AND_WHITESPACE_bug into 7d42f58 on tedious:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 84.737% when pulling 42723e2 on iclukas:Mitigate_T_ENCAPSED_AND_WHITESPACE_bug into 7d42f58 on tedious:master.

@tedivm tedivm merged commit e155ca9 into tedious:master Feb 10, 2021
@tedivm
Copy link
Member

tedivm commented Feb 10, 2021

Thanks for the PR!

@tedivm
Copy link
Member

tedivm commented Feb 10, 2021

I'll attempt to get a release out later today.

@iclukas iclukas deleted the Mitigate_T_ENCAPSED_AND_WHITESPACE_bug branch May 24, 2022 15:28
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.

3 participants