Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help, I'm stumped on objects! I don't want to use ASP!

Status
Not open for further replies.

rybo

Technical User
Jun 8, 2002
36
US
I have the following example:

$user = new COM('MailServerX.User') or die("Did not work");
$user->UserNames="joe";
$user->Password="secret";
$user->Release();
$user=null;

...Which does nothing more than declare an object, set some of its variables, and then release the object (this is an example for ArgoSofts Mailserver and I think the syntax is correct). It doesn't die, it just hangs (PHP produces no errors or warnings). So my question is:

Anyone with experience with objects: What is causing it to hang (and by hang I mean the browsers progress bar just sort of crawls along and it never finishes loading)?????
 
I think this is probably more of a COM problem then a PHP one, but I will mention one thing:

In PHP, whenever you invoke an instance of an object with the 'new' keyword, the default behavior is for PHP to return a whole copy of the object, instead of passing by reference, as with Java, and many other O-O languages. Obviously, this can result an massive memory overhead for certain things.

With Zend 2 (coming for PHP 5), this default behavior will be changed to reflect the standards more closely.

For now, though, if you want to invoke an object by reference, you need to explicitly add the reference operator '&':

Code:
$user =& new COM('MailServerX.User') or die("Did not work");

This might help in your situation. Other than this, I would recommend spending more time checking the COM syntax for your application. -------------------------------------------

Big Brother: "War is Peace" -- Big Business: "Suspicion is Trust"
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top