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

Php7 Problem with TemplateProcessor Destructor #2554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oleibman
Copy link
Contributor

Description

A particularly perplexing problem accidentally introduced by PR #2475. Problem does not arise for Php8, and does not arise for Php7 unit tests. But, running not under Phpunit auspices with Php7 can cause a warning message at destructor time if the save function has been used. A very artificial test is introduced to test this situation.

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # 2548

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes

Fix PHPOffice#2548. A particularly perplexing problem accidentally introduced by PR PHPOffice#2475. Problem does not arise for Php8, and does not arise for Php7 unit tests. But, running *not* under Phpunit auspices with Php7 can cause a warning message at destructor time if the `save` function has been used. A very artificial test is introduced to test this situation.
@coveralls
Copy link

Coverage Status

coverage: 97.218% (+0.001%) from 97.217%
when pulling e295f86 on oleibman:word2548
into 2f4da6e on PHPOffice:master.

Comment on lines +173 to +175
$result = false;
}
if ($result === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$result = false;
}
if ($result === false) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, your suggestion changes the program logic. We should get false for the result of close. Php8 changed that, and I have filed a bug with Php about it. For Php7, we still get false, and we want to throw an exception (to avoid a compatibility break for Php7, which is what this change is all about). We also want to throw an exception when Php8 (erroneously) throws an exception for close. The way to handle both is to evaluate $result outside the try-catch, as I have currently coded it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, your suggestion changes the program logic. We should get false for the result of close. Php8 changed that, and I have filed a bug with Php about it. For Php7, we still get false, and we want to throw an exception (to avoid a compatibility break for Php7, which is what this change is all about). We also want to throw an exception when Php8 (erroneously) throws an exception for close. The way to handle both is to evaluate $result outside the try-catch, as I have currently coded it.

I would like to ask, how can I get Progi1984 to review my code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a big backlog, and I think he is being very careful and methodical in how he's trying to catch up. I'm sure he will get to your PR, perhaps not as quickly as you would like, but hopefully not too long.

Copy link
Member

@Progi1984 Progi1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants