class &reference problem
| From: | Hernan Marino | Date: | Mon, 26 Apr 2004 13:14:35 +0000 |
| Subject: | class &reference problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184627@lists.php.net to get a copy of this message | ||
Hello. I have this problem:
class A{
function A(){
$this->X = new X($this);
$this->Sock=fsockopen(ip,port,err,errstr,timeout);
}
}
Class X {
function X (&$ct){
$this->ct =&$ct;
}
.
.
.
function foo(){
if(is_resource($this->ct->Sock)){
echo("OK");
}else{
echo("NO NO");
}
}
}
When I try to access A->Socket from function foo() in class X, it is
not there, it is not a resource. I've used this arrangement to access
functions in every class from every class without a problem. In fact I
can access any other function of A from X, except the resource for
fsockopen.
Does anybody knows if fsockopen has specific restrictions used int
this way? If that is the case, any solution you may think/know?
Many thanks in advance.
H Marino