php-src/ext/com_dotnet
2006-10-18 23:47:46 +00:00
..
tests MFB51: Fixed bug #34272 (empty array onto COM object blows up) 2006-02-04 10:59:18 +00:00
com_com.c MFB: Fixed bug #38198 (possible crash when COM reports an exception). 2006-10-10 17:33:02 +00:00
com_dotnet.c bump year and license version 2006-01-01 13:10:10 +00:00
com_extension.c MFB: Fixed bug #38400 (Use of com.typelib_file may cause a crash). 2006-10-18 23:47:46 +00:00
com_handlers.c - Add an extra parameter to the cast_object handler that can be used by 2006-10-13 14:52:19 +00:00
com_iterator.c modify get_iterator calls for engine change 2006-02-07 11:52:45 +00:00
com_misc.c Made server wide switch for unicode on/off (according to PDM). 2006-02-13 10:23:59 +00:00
com_olechar.c bump year and license version 2006-01-01 13:10:10 +00:00
com_persist.c MFB: Added missing validation checks around expand_filepath() 2006-09-16 18:23:05 +00:00
com_saproxy.c fix build 2006-04-29 18:45:29 +00:00
com_typeinfo.c MFB: Fixed #37602 by olek at neurosoft dot pl 2006-08-25 12:03:31 +00:00
com_variant.c MFB51: Fixed bug #34272 (empty array onto COM object blows up) 2006-02-04 10:59:18 +00:00
com_wrapper.c bump year and license version 2006-01-01 13:10:10 +00:00
config.w32 Implement com_get_active_object() and a helper object for working with 2004-05-09 15:21:29 +00:00
CREDITS add credits 2003-08-14 20:48:06 +00:00
package.xml "The Visa to Sibiria" (work in progress) 2004-03-23 19:46:10 +00:00
php_com_dotnet_internal.h fix build 2006-04-29 18:45:29 +00:00
php_com_dotnet.h bump year and license version 2006-01-01 13:10:10 +00:00
README Fixup some constants and error handling. 2004-05-03 15:51:41 +00:00

This is the new php5 COM module.

It is not 100% backwards compatible with PHP 4 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 PHP 4, 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 PHP 4 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:

- documentation

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