You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Wez Furlong 0577d9310b bah. does it really make any difference where rewind lives in the struct!? 22 years ago
..
tests Add new COM (and .Net) extension for php5. 23 years ago
CREDITS add credits 23 years ago
README Add new COM (and .Net) extension for php5. 23 years ago
com_com.c A much better fix for moniker based COM object creation. 22 years ago
com_dotnet.c fix .net build 23 years ago
com_extension.c add com iterator support 22 years ago
com_handlers.c Fix possible segfault (this one came up when a method could not be found). 22 years ago
com_iterator.c bah. does it really make any difference where rewind lives in the struct!? 22 years ago
com_misc.c Add new COM (and .Net) extension for php5. 23 years ago
com_olechar.c emalloc -> safe_emalloc 23 years ago
com_typeinfo.c Add new COM (and .Net) extension for php5. 23 years ago
com_variant.c Add new COM (and .Net) extension for php5. 23 years ago
php_com_dotnet.h Add new COM (and .Net) extension for php5. 23 years ago
php_com_dotnet_internal.h add com iterator support 22 years ago

README

This is the new php5 COM module.

It is not 100% backwards compatible with php4 ext/com, but you should not miss
the "features" that have not been retained.

This module exposes 3 classes: variant, com and dotnet(*).
com and dotnet classes are descendants of the variant class; the only
difference between the three are their constructors. Once instantiated, the
module doesn't make a distinction between them.

COM errrors are mapped to exceptions; you should protect your COM code using
the try..catch construct if you want to be able to handle error conditions.

Be warned that due to the way the ZE2 currently works, exceptions are only
"armed" at the time they are detected, but do not "detonate" until the end of
the statement. So, code like this:

$obj->foo[43]->bar();

Where the foo[43] access triggers an exception will continue to call the bar()
method on a null object and cause a fatal php error.

Default properties and array access:

$obj = new COM("...");
$obj[1]->foo();

The code above will use the type information for the object to determine its
default property and then access it. In php4, it was hard-coded to use the
"Items" member, which was wrong.

The default property will also be used by the casting support to determine the
value for the object.

Variants:

This implementation of COM takes a simpler approach than the php4 version;
we only map a few native types to COM and vice-versa, leaving the more complex
things as variants. This allows greater consistency of data when passing
parameters to and from COM objects (no data will be lost). In addition, a
large number of the variant API has been mapped to PHP space so that you can
use it for working with the special variant decimal, currency and date time
types. This could be used as a replacement for the bcmath extension, for
example.

You can use the new object casting hook to for a php-native representation of
a variant object:

$a = new variant(4);
$b = new variant(6);
$c = variant_add($a, $b);
echo $c; // outputs 10 as a string, instead of Object

Sample Script:

<?php
$word = new COM("word.application");
print "Loaded Word, version {$word->Version}\n";
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
$word->Quit();
?>

TODO:

- Dispatch wrapper for PHP objects.
The wrapper will enable you to sink events sourced from COM objects,
and allow ActiveScript sapi to function again.
- Indexed array function for (g|s)etting array-style properties that are not
actually arrays.
- SafeArray support for variant class.
Currently there is no way to access a safearray from php.
- A few other com_xxx functions need to be ported from the php4 extension.
- documentation

* dotnet support requires that you have the mscoree.h header from the .net sdk
when you build the module.