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

PhpOffice\PhpWord\Element\AbstractContainer error suppression #468

Open
daum opened this issue Jan 8, 2015 · 2 comments
Open

PhpOffice\PhpWord\Element\AbstractContainer error suppression #468

daum opened this issue Jan 8, 2015 · 2 comments

Comments

@daum
Copy link

daum commented Jan 8, 2015

In AbstractContainer.php on line 101 right now there is the following:

@list($count, $fontStyle, $paragraphStyle) = $args; // Suppress error

The issue is if a user has listeners for warnings/errors that they will still get the error which then can cause their scripts to send extra alert emails. Switching this to the following would have the same affect, just never produce the warnings to the listeners:

if (isset($args[0])) {
    $count = $args[0];
}
else {
    $count = null;
}
// Same for rest of variables

I'll submit a PR with the full fix. While this does have a few more lines of code, it will allow error monitoring to continue without false positives.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

daum added a commit to daum/PHPWord that referenced this issue Jan 8, 2015
…ss error as we check if indexes exists. This fixes issues with error listeners getting triggered on suppressed errors. Addresses issue PHPOffice#468
@gmta
Copy link
Contributor

gmta commented Feb 8, 2015

The issue is if a user has listeners for warnings/errors that they will still get the error which then can cause their scripts to send extra alert emails.

Yeah, if you use set_error_handler() then you should also read the remark about it bypassing error_reporting() completely. This is not PHPWord at fault with error suppression, this is your custom error handling ignoring the error level.

Fix your code:

if (!(error_reporting() & $errno)) {
    return;
}

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 18, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants