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

PHP 8 focused error handler should also accept PHP 7 notices #736

Closed
rudiedirkx opened this issue Feb 18, 2022 · 4 comments · Fixed by #829
Closed

PHP 8 focused error handler should also accept PHP 7 notices #736

rudiedirkx opened this issue Feb 18, 2022 · 4 comments · Fixed by #829
Milestone

Comments

@rudiedirkx
Copy link

Smarty_Internal_ErrorHandler::handleError() only checks for PHP 8 style error strings, but not "Undefined index: abc". I can do that somewhere else, or not listen for notices, but why not here where the same logic for PHP 8 lives.

Probably add inside the allowUndefinedArrayKeys block: Undefined index:

@rudiedirkx
Copy link
Author

I'm running the same Smarty 4.1 app on a PHP 8.0 and a PHP 7.4 machine, and the error handler only works as expected on PHP 8.0. I have my app's error handler checking for Smarty notices now =(

@Rambomst
Copy link

I am also running into this issue, the PR attached resolved the problem. Thanks @rudiedirkx.

Any word on when this will be merged/released @wisskid?

@wisskid
Copy link
Contributor

wisskid commented Sep 27, 2022

@Rambomst do you have a code example that triggers the error? I'll add a unit test and merge it asap

@Rambomst
Copy link

Rambomst commented Sep 27, 2022

@Rambomst do you have a code example that triggers the error? I'll add a unit test and merge it asap

@wisskid

Honestly, no.

We do set the error_reporting value for smarty by doing:

$smarty->error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING

This is happening in a monolithic application and I was only able to validate this working by manually modifying the vendor file on a dev server, unfortunately I don't have a neat snippet.

I am happy to provide as much information as I can, let me know if you need anything else.

This is happening on PHP 7.2.34 and we are using Sentry error reporting which does some error handling itself.

Sorry I'm not more helpful :(

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 a pull request may close this issue.

3 participants