Skip to content

Commit c5eab5d

Browse files
committed
Merge pull request #19 from sapfeer0k/master
pFilename is required parameter for save
2 parents 50fd978 + 4e4a476 commit c5eab5d

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Images in Layouts other than first Master Slide within Template file causes corrupted PPTX - @maartenba CP-4596
3434
- Fixed A3 and A4 formats dimensions - @delphiki GH-16
3535
- Fixed custom document layout - @delphiki GH-18
36+
- Filename parameter is required for IWriter::save method
3637

3738
### Miscellaneous
3839

Classes/PHPPowerPoint/Writer/IWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ interface PHPPowerPoint_Writer_IWriter
4040
* @param string $pFilename
4141
* @throws Exception
4242
*/
43-
public function save($pFilename = null);
43+
public function save($pFilename);
4444
}

Classes/PHPPowerPoint/Writer/ODPresentation.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ public function __construct(PHPPowerPoint $pPHPPowerPoint = null)
102102
* @param string $pFilename
103103
* @throws Exception
104104
*/
105-
public function save($pFilename = null)
105+
public function save($pFilename)
106106
{
107+
if (empty($pFilename)) {
108+
throw new Exception("Filename is empty");
109+
}
107110
if (!is_null($this->_presentation)) {
108111
// If $pFilename is php://output or php://stdout, make it a temporary file...
109112
$originalFilename = $pFilename;

Classes/PHPPowerPoint/Writer/PowerPoint2007.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ public function getWriterPart($pPartName = '')
139139
* @param string $pFilename
140140
* @throws Exception
141141
*/
142-
public function save($pFilename = null)
142+
public function save($pFilename)
143143
{
144+
if (empty($pFilename)) {
145+
throw new Exception("Filename is empty");
146+
}
144147
if (!is_null($this->_presentation)) {
145148
// If $pFilename is php://output or php://stdout, make it a temporary file...
146149
$originalFilename = $pFilename;

Classes/PHPPowerPoint/Writer/Serialized.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ public function __construct(PHPPowerPoint $pPHPPowerPoint = null)
5858
* @param string $pFilename
5959
* @throws Exception
6060
*/
61-
public function save($pFilename = null)
61+
public function save($pFilename)
6262
{
63+
if (empty($pFilename)) {
64+
throw new Exception("Filename is empty");
65+
}
6366
if (!is_null($this->_presentation)) {
6467
// Create new ZIP file and open it for writing
6568
$objZip = new ZipArchive();

0 commit comments

Comments
 (0)