Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Excel2007 writer's save() should return TRUE when file is successfully closed #236

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

Conversation

Doggie52
Copy link

I believe this should be put in place for all the other writers too, just haven't done this yet. Want to know if there's some form of coding practice you have in place that prevents these functions from returning a value before I put any time into modifying the other writers.

As it stands now, there is no way of knowing whether or not the save was successful. Or am I missing something? Should I be using a try-catch block?

@Doggie52
Copy link
Author

If not returning true/false but instead either triggering an exception or do nothing is part of some coding paradigm please let me know :) . I was unsure, and I would have needed it to return true in my application so I thought this may have been something overlooked, although I am not certain of this.

@@ -355,6 +355,8 @@ public function save($pFilename = null)
// Close file
if ($objZip->close() === false) {
throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
} else {
return true;
Copy link

Choose a reason for hiding this comment

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

You're returning too early; the return should be underneath the next if block.

@Doggie52
Copy link
Author

Doggie52 commented Dec 4, 2013

I see what you mean, but I doubt this is the right way to do things anyway so I've sort of given up hope on this request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants