Re: Use of OLE constants in PHP



On 30.07.2007 11:23 Patrick wrote:
gosha bine a écrit :

What does it say if you do

com_load_typelib("Word.Application");
print_r(preg_grep('/^wd/',
array_keys(get_defined_constants())));


The first time I execute it, I got :

Array
(
[1032] => wdNoMailSystem
[1033] => wdMAPI
[1034] => wdPowerTalk
[1035] => wdMAPIandPowerTalk
[1036] => wdNormalTemplate
[1037] => wdGlobalTemplate
[1038] => wdAttachedTemplate
[1039] => wdContinueDisabled
[1040] => wdResetList
[1041] => wdContinueList
[1042] => wdIMEModeNoControl
.....
)

and I have no error in Word but from the second execution, I got only

Array
(
)

and Word raise the exception.



I tried your code on several different php/xp/office combinations and got everything possible from php exceptions to system crashes. The code works fine if I remove com_load_typelib and replace wd... constants with numeric values. This makes me think 'com_load_typelib' is somewhat unstable and I'd suggest you just get rid of it. Define constants you need directly in php (you can pull constant definitions out of the OLB file using oleview or similar tool).


--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
.



Relevant Pages

  • Re: ionCube PHP Encoder / Loader on FreeBSD 6 / 7
    ... patrick wrote: ... I'm having problems getting ionCube's PHP loader working on either ... instructions, edited php.ini, installed compat5x and compat6x libraries, ... Both boxes are running PHP 5.2.5. ...
    (freebsd-questions)
  • Re: Not fully OO ?
    ... I will occasionally use php. ... So even terrible languages can have their uses! ... I think Patrick is responding to a comment from Tino Wildenhain: ... sorry for the confusion everyone. ...
    (comp.lang.python)
  • Re: Not fully OO ?
    ... I will occasionally use php. ... So even terrible languages can have their uses! ... I think Patrick is responding to a comment from Tino Wildenhain: ... [end quote] ...
    (comp.lang.python)
  • Re: help putting zero in front of single digits in select
    ... Patrick of comp.lang.php make plain: ... How do I make php put a zero in front of the ... echo $x; ...
    (comp.lang.php)