Bug #73605 [NEW]: COM Word.application SaveAs Type conflict

From: Date: Fri, 25 Nov 2016 09:22:37 +0000
Subject: Bug #73605 [NEW]: COM Word.application SaveAs Type conflict
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205628@lists.php.net to get a copy of this message
From: tt at prof4 dot net Operating system: Windows 10 Pro Apache 2.4 PHP version: 7.0.13 Package: *PDF functions Bug Type: Bug Bug description:COM Word.application SaveAs Type conflict Description: ------------ I am not sure if this is relating to the topic of "PDF functions". We tested the following script with PHP5.4 and PHP7. It works perfectly with PHP5.4 but generates an error in PHP7 (Same configuration for the environment but the Port for Apache24 is different to the port for Apache22 with PHP5.4) We also tested it with the SaveAs2 function and also we checked the parameters for "Open()". We are using Word Version 14. Test script: --------------- function rtf2pdf($path) { if (!class_exists('COM')) { return false; } $word = new COM("word.application"); if (!$word) { return false; } if ($word->Version < 12) { $word->Quit(); return false; } $word->Documents->Open($path, false, true); $wdSaveFormats = array( 'docx' => 16, 'html' => 10, 'rtf' => 6, 'txt' => 2, 'doc' => 0, 'pdf' => 17 ); $new_file = str_replace('.rtf', '.pdf', $path); $word->ActiveDocument->SaveAs($new_file, $wdSaveFormats['pdf']); $word->ActiveDocument->SaveAs2($new_file, $wdSaveFormats['pdf']); $word->ActiveDocument->Close(false); $word->Quit(); return $new_file; } echo rtf2pdf('C:\\mydoc.rtf'); Expected result: ---------------- C:\mydoc.pdf Actual result: -------------- Fatal error: Uncaught com_exception: Parameter 0: Typenkonflikt. in rtftest.php:24 Stack trace: #0 rtftest.php(24): variant->SaveAs('C:\\mydoc.pdf', 17) #1 rtftest.php(31): rtf2pdf('C:\\mydoc.rtf') #2 {main} thrown in rtftest.php on line 24 -- Edit bug report at https://bugs.php.net/bug.php?id=73605&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73605&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73605&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73605&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73605&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73605&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73605&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73605&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73605&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73605&r=support Expected behavior: https://bugs.php.net/fix.php?id=73605&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73605&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73605&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73605&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73605&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73605&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73605&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73605&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73605&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73605&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73605&r=mysqlcfg

« previous php.bugs (#205628) next »