Skip to content

Can't run any samples, ZipArchive fails ? #450

@Kwaadpepper

Description

@Kwaadpepper

I trie to run the sample in my environement:

it give no output and i got an error:

[Fri Dec 19 18:02:03.673559 2014] [:error] [pid 9191] [client 127.0.0.1:41766] PHP Fatal error:  Uncaught exception 'PhpOffice\\PhpWord\\Exception\\Exception' with message 'Could not close zip file /home/kwaadpepper/www/word/samples/Sample_11_ReadWord2007.docx.' in /home/kwaadpepper/www/word/src/PhpWord/Shared/ZipArchive.php:161\nStack trace:\n#0 /home/kwaadpepper/www/word/src/PhpWord/Writer/Word2007.php(139): PhpOffice\\PhpWord\\Shared\\ZipArchive->close()\n#1 /home/kwaadpepper/www/word/samples/Sample_Header.php(66): PhpOffice\\PhpWord\\Writer\\Word2007->save('/home/kwaadpepp...')\n#2 /home/kwaadpepper/www/word/samples/Sample_11_ReadWord2007.php(12): write(Object(PhpOffice\\PhpWord\\PhpWord), 'Sample_11_ReadW...', Array)\n#3 {main}\n  thrown in /home/kwaadpepper/www/word/src/PhpWord/Shared/ZipArchive.php on line 161, referer: http://127.0.0.1/word/samples/

I'm on ubuntu 14.04, i've chmoded -R 777 ressources

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38

HP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

for example i've been triying first:

$phpWord = new PhpOffice\PhpWord\PhpWord();
$phpWord->loadTemplate(ROOT.'/Sample_07_TemplateCloneRow.docx');
var_dump($phpWord);die;

and it is empty:

object(PhpOffice\PhpWord\PhpWord)[118]
  private 'documentProperties' => 
    object(PhpOffice\PhpWord\DocumentProperties)[103]
      private 'creator' => string '' (length=0)
      private 'lastModifiedBy' => string '' (length=0)
      private 'created' => int 1419008097
      private 'modified' => int 1419008097
      private 'title' => string '' (length=0)
      private 'description' => string '' (length=0)
      private 'subject' => string '' (length=0)
      private 'keywords' => string '' (length=0)
      private 'category' => string '' (length=0)
      private 'company' => string '' (length=0)
      private 'manager' => string '' (length=0)
      private 'customProperties' => 
        array (size=0)
          empty
  private 'sections' => 
    array (size=0)
      empty
  private 'titles' => 
    object(PhpOffice\PhpWord\Collection\Titles)[120]
      private 'items' (PhpOffice\PhpWord\Collection\AbstractCollection) => 
        array (size=0)
          empty
  private 'footnotes' => 
    object(PhpOffice\PhpWord\Collection\Footnotes)[121]
      private 'items' (PhpOffice\PhpWord\Collection\AbstractCollection) => 
        array (size=0)
          empty
  private 'endnotes' => 
    object(PhpOffice\PhpWord\Collection\Endnotes)[122]
      private 'items' (PhpOffice\PhpWord\Collection\AbstractCollection) => 
        array (size=0)
          empty

I think it is a related problem with class ZipArchive that canno't open the file form my example.
It makes a file: /tmp/ro1OSL, but it is empty.

Any ideas ? (the file in input isn't empty, and i'v tried multiples files form multiple sources.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions